error

3 views
Skip to first unread message

xina towner

unread,
Feb 13, 2012, 6:51:03 AM2/13/12
to django...@googlegroups.com
Hi, I get this message when I try to acces to the admin page:

AlreadyRegistered at /admin


The model Location is already registered

does anybody know which is the problem?

--
Gràcies,

Rubén

Jonathan Paugh

unread,
Feb 13, 2012, 1:02:51 PM2/13/12
to django...@googlegroups.com
On 02/13/2012 06:51 AM, xina towner wrote:
> Hi, I get this message when I try to acces to the admin page:
>
> AlreadyRegistered at /admin
>
>
> The model Location is already registered
>
>
> does anybody know which is the problem?
>

This is a horrible, horrible problem which I've worked around as follows:


from django.contrib.admin import site

def adminRegister(model, admin_class=None, **kwargs):
'''(Re)register a model with the AdminSite site.'''
if model in site._registry:
site.unregister(model)
site.register(model, admin_class, **kwargs)

class MagicModel(models.Model):
pass
adminRegister(MagicModel)


I encountered this whenever I tried to run ./manage.py shell and
./manage.py runserver at the same time. If I understood what I read in
the development list, though, this is being fixed for release 1.4.

Reply all
Reply to author
Forward
0 new messages