Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8181 closed (duplicate)

Documentation error leads to 'model already registered exceptions'

Reported by: Marc Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The documentation says to add admin model registration to the end of the models.py file. Because this file may be imported more than once, this causes a 'model _ already registered exception'. The solution is to use autodiscover (as suggested in the documentation) but to place the model registration in the file admin.py.

See http://groups.google.com/group/django-users/browse_thread/thread/8af97d45102ee2f2 .

Change History (7)

comment:1 Changed 8 years ago by Malcolm Tredinnick

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: invalid
Status: newclosed

I cannot see where in admin.txt we are saying to put the registration in models.py. Please reopen the ticket if you are looking at an up-to-date checkout. Include the line number and file where you believe the problem is.

comment:2 Changed 8 years ago by wiremine@…

Resolution: invalid
Status: closedreopened

I was able to reproduce the problem this way:

  1. Part 2 of the tutorial suggests registering the model with the admin in the "Make the poll app modifiable in the admin" section.
  1. If you then import a model as described in the "Generics" documentation, you then raise a "ImproperlyConfigured" exception.

The solution is to use admin.py instead of models.py

comment:3 Changed 8 years ago by Malcolm Tredinnick

milestone: 1.0
Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by James Bennett

Resolution: duplicate
Status: reopenedclosed

Duplicate of #7964.

comment:5 in reply to:  1 Changed 8 years ago by bb_cisze@…

Has patch: set
Needs documentation: set
Needs tests: set
Resolution: duplicate
Status: closedreopened


[]

[]



Replying to mtredinnick:

I cannot see where in admin.txt we are saying to put the registration in models.py. Please reopen the ticket if you are looking at an up-to-date checkout. Include the line number and file where you believe the problem is.

comment:6 Changed 8 years ago by Carl Meyer

Has patch: unset
Needs documentation: unset
Needs tests: unset
Resolution: duplicate
Status: reopenedclosed

comment:7 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top