Skip to content

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

@jogwen

Description

@jogwen

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions