Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 June 23, 2010 16:53:06

Jonathan H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django-tagging registering


I have, in my code:

import tagging

class Entity(models.Model):
...

tagging.register(Entity)


I'm getting an error. So far as I can tell, this is the only time
tagging.register() is called, although I do call
admin.site.register(Entity). Any ideas how I might be making a redundant
request? If this is happening because the file is being imported more than
once, what is an appropriate way to guarantee that Entity is only registered
once?

AlreadyRegistered at /

The model 'Entity' has already been registered.

Request Method:GETRequest URL:http://linux:8000/ExceptionType:
AlreadyRegisteredException Value:

The model 'Entity' has already been registered.

Exception
Location:/usr/local/lib/python2.6/dist-packages/django_tagging-0.3.1-py2.6.egg/tagging/__init__.py
in register, line 39Python Executable:/usr/bin/pythonPython Version:2.6.5Python
Path:Server time:Wed, 23 Jun 2010
10:46:07 -0500


--
→ Jonathan Hayward, christos.jonathan.hayw...@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site athttp://JonathansCorner.com/--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 23, 2010 17:05:37

Karen T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django-tagging registering


On Wed, Jun 23, 2010 at 11:52 AM, Jonathan Hayward <
christos.jonathan.hayw...@gmail.com> wrote:

> what is an appropriate way to guarantee that Entity is only registered
> once?
>

Yes, it happens because models.py may be imported more than once. You
should put admin registrations in an admin.py file, not models.py, and call
admin.autodiscover() from urls.py. See:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-objectsandhttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf.

Karen
--http://tracey.org/kmt/--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 20th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support