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

'Tag' object has no attribute 'name_any' #16

Open
jogwen opened this issue Aug 4, 2015 · 2 comments
Open

'Tag' object has no attribute 'name_any' #16

jogwen opened this issue Aug 4, 2015 · 2 comments

Comments

@jogwen
Copy link

jogwen commented Aug 4, 2015

I'm experiencing this exception a lot when trying to update the tags of an object o whose o.tags is non-empty (see below). I realised that in my version (0.3.3, from pip), nothing seems to define what name_any should be. Same when I git cloned the HEAD from here (github). I think this must be a bug is it?

In [129]: v.tags
Out[129]: []

In [130]: v.tags = '"tag 1", tag2'

In [132]: v.tags
Out[132]: [<Tag: tag 1>, <Tag: tag2>]

In [133]: v.tags = 'tag3'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/virtualenvs/nhschoices/local/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 v.tags = 'tag3'

/virtualenvs/nhschoices/local/lib/python2.7/site-packages/tagging/managers.pyc in __set__(self, instance, value)
     63 
     64     def __set__(self, instance, value):
---> 65         Tag.objects.update_tags(instance, value)
     66 
     67     def __delete__(self, instance):

/virtualenvs/nhschoices/local/lib/python2.7/site-packages/tagging/models.pyc in update_tags(self, obj, tag_names)
     54                                                tag__in=tags_for_removal).delete()
     55         # Add new tags
---> 56         current_tag_names = [tag.name_any for tag in current_tags]
     57         for tag_name in updated_tag_names:
     58             if tag_name not in current_tag_names:

AttributeError: 'Tag' object has no attribute 'name_any'
@svetlyak40wt
Copy link
Owner

Hi @jogwen nice to see someone who uses tagging-ng these days. I have no time to support this libarary anymore. If you wish, you could add a test for this bug and fix it. I'll accept a pull.

@jogwen
Copy link
Author

jogwen commented Aug 4, 2015

Hi @svetlyak40wt, thanks for responding. I'm looking at django_tagging_ng because it's installed in a project I'm working on. I see that django_tagging is being maintained a bit more than your version, so I might evaluate whether we can switch over (and whether switching would fix the issues I'm finding here). If not then I'll come back and fix here. Thanks.

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