Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create single character tags when using a tag tree model #81

Closed
mcrot opened this issue Oct 15, 2019 · 1 comment
Closed

Cannot create single character tags when using a tag tree model #81

mcrot opened this issue Oct 15, 2019 · 1 comment

Comments

@mcrot
Copy link
Contributor

mcrot commented Oct 15, 2019

I'm using tagulous version 0.14.1 and the following tag model (inside an app called "manager"):

import tagulous.models as tm
class TagModel(tm.TagTreeModel):
    class TagMeta:
        force_lowercase = True

During testing my app I see the following behaviour (on sqlite database):

I can create the tags projects/ABC and projects/AB without problems. The resulting tags
in the database are: ['projects', 'projects/AB', 'projects/ABC'].

Then, if I try to create the tag projects/A (only a single character label A), the library
tries to generate projects which is already there:

IntegrityError: duplicate key value violates unique constraint "manager_tagmodel_name_key"
DETAIL:  Key (name)=(projects) already exists.

Or, when starting fresh without any tags, the statement

TagModel.objects.create(name='projects/A') 

only creates the tag projects(without A). Is this expected behaviour?
I would expect that projects/A is a tag like projects/ABC.

@radiac
Copy link
Owner

radiac commented Jun 29, 2020

Finally merged - thanks for the excellent patch, and once again sorry for the delay! This will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants