Opened 3 years ago

Last modified 3 years ago

#16883 new Bug

Importing from not-installed app prevents any other app with that label from loading

Reported by: carljm Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If a from an app that is not listed in INSTALLED_APPS happens to be imported for whatever reason, that (not-installed) app takes over the app-label in the app cache, making it impossible for any app actually in INSTALLED_APPS to use that app-label. This is wrong - an import should not have such a side effect. INSTALLED_APPS should be the arbiter of what apps are actually found in the app cache.

The fix for #16283 worked around this problem and removed the immediate symptom, but didn't address the underlying issue.

The fix for #15866 addressed a similar issue, but didn't fix this.

This may be fixed in the app-loading branch, and in any case is closely-related to the changes there.

Attached tarball is a simplest-case and app demonstrating the issue; run " validate" to see the problem. The models from contrib.auth are being validated even though that app is not installed, simply because its has been imported. The presence of another INSTALLED_APP with the "auth" app-label causes the app cache to be confused into thinking that contrib.auth is actually installed, when it is not.

Attachments (1)

uninstalled-models.tgz (3.0 KB) - added by carljm 3 years ago.
project demonstrating the problem

Download all attachments as: .zip

Change History (2)

Changed 3 years ago by carljm

project demonstrating the problem

comment:1 Changed 3 years ago by ptone

  • Triage Stage changed from Unreviewed to Accepted

Downloaded the demo and validated the problem

Add Comment

Modify Ticket

Change Properties
<Author field>
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'

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

Note: See TracTickets for help on using tickets.