Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 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 .

Attachments (0)

Change History (7)

comment:1 follow-up: Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 6 years ago by wiremine@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

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 6 years ago by mtredinnick

  • milestone set to 1.0
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 6 years ago by ubernostrum

  • Resolution set to duplicate
  • Status changed from reopened to closed

Duplicate of #7964.

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

  • Has patch set
  • Needs documentation set
  • Needs tests set
  • Resolution duplicate deleted
  • Status changed from closed to reopened


[]

[]



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 6 years ago by carljm

  • Has patch unset
  • Needs documentation unset
  • Needs tests unset
  • Resolution set to duplicate
  • Status changed from reopened to closed

comment:7 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.