Opened 12 years ago

Closed 10 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:


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.

Change History (3)

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

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 11 years ago by James Bennett

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

comment:3 Changed 10 years ago by Jacob

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top