Django tag: already registered exception

I have installed Django tags. I read the tutorial and figured out how it works. In my models:

import tagging class TaggingWidget(models.Model): """Widget for tagging.""" name = models.CharField(max_length = 50) tagging.register(TaggingWidget) 

When I tried to import the widget into the shell, I have an exception:

 In [1]: from soapapp import models --------------------------------------------------------------------------- AlreadyRegistered Traceback (most recent call last) /home/user/workspace/soapbox/<ipython console> in <module>() /home/user/workspace/soapbox/soapapp/models.py in <module>() 8 9 ---> 10 tagging.register(TaggingWidget) 11 12 /home/user/Envs/env1/lib/python2.6/site-packages/tagging/__init__.pyc in register(model, tag_descriptor_attr, tagged_item_manager_attr) 37 if model in registry: 38 raise AlreadyRegistered("The model '%s' has already been " ---> 39 "registered." % model._meta.object_name) 40 if hasattr(model, tag_descriptor_attr): 41 raise AttributeError("'%s' already has an attribute '%s'. You must " AlreadyRegistered: The model 'TaggingWidget' has already been registered. 

What's wrong? What should I do?

+4
source share
1 answer

There seems to be an open issue with django tags . A simple workaround is

 try: tagging.register(TaggingWidget) except tagging.AlreadyRegistered: pass 
+8
source

All Articles