Code

Opened 8 years ago

Closed 7 years ago

#1824 closed defect (duplicate)

Name clashes in user-installed apps cause duplications in Admin Interface

Reported by: jermy Owned by: nobody
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I naively created a new Django application called 'admin', created a suitable model to access an existing database, and set up the admin interface to access it. Unfortunately, this resulted in two 'Admin' modules, and two sets of my models appearing in the admin interface.

Debugging this, I see that in django.db.models.loading there is a _app_models dictionary which only stores as a key the name of the modules - 'admin' in this case, rather than the whole path. This is handled with code such as:

    return _app_models.get(app_mod.__name__.split(".")[-2], {}).values()

I appreciate that app names want to be short and unique for database use, but feel that either:

  1. This should work and use a fully-qualified name, particularly given users are likely to use many 3rd-party applications in the future and conflicts will arise.
  2. It should raise an Exception if conflicting module names exist.

Attachments (0)

Change History (3)

comment:1 Changed 7 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by ubernostrum

This is an app_label issue at heart, so closing in favor of #3591.

comment:3 Changed 7 years ago by jacob

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

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.