#8181 closed (duplicate)
Documentation error leads to 'model already registered exceptions'
| Reported by: | Marc | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| 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)
follow-up: 5 comment:1 by , 17 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:2 by , 17 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → reopened |
I was able to reproduce the problem this way:
- Part 2 of the tutorial suggests registering the model with the admin in the "Make the poll app modifiable in the admin" section.
- 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 by , 17 years ago
| milestone: | → 1.0 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:5 by , 17 years ago
| Has patch: | set |
|---|---|
| Needs documentation: | set |
| Needs tests: | set |
| Resolution: | duplicate |
| Status: | closed → reopened |
[]
[]
Replying to mtredinnick:
I cannot see where in
admin.txtwe are saying to put the registration inmodels.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 by , 17 years ago
| Has patch: | unset |
|---|---|
| Needs documentation: | unset |
| Needs tests: | unset |
| Resolution: | → duplicate |
| Status: | reopened → closed |
I cannot see where in
admin.txtwe are saying to put the registration inmodels.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.