Code

Opened 3 years ago

Closed 3 years ago

#15735 closed Bug (duplicate)

Conflict with an app name of 'auth' even when not using Django auth

Reported by: mattrobenolt Owned by: mattrobenolt
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: auth settings
Cc: mattrobenolt Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

When starting a project from scratch and I remove all of the default apps out of INSTALLED_APPS, and create an app of my own called "auth", Django traverses through and registers the django.contrib.auth models automatically.

I found the source of the problem with django.core.management.validators. At the point of including any part of this module, django.contrib.auth is added into the app_store cache in django.db.models.loading. Once it has been cached in the app_store, it overrides MY 'auth' app because cache keys are stored by doing: "app.name.split('.')[-2]".

After digging through and tracing up, I found that I could simply comment out line 3 of django/core/management/validators.py and it prevents the extra models from ever being initialized unless specifically declared in settings.py

This may or may not be the best solution for the problem, but I have patched this in on a few projects of mine without any negative consequences. I can't determine if there's a better way to actually test it.

Attachments (1)

fix_for_conflicting_auth.diff (445 bytes) - added by mattrobenolt 3 years ago.

Download all attachments as: .zip

Change History (6)

Changed 3 years ago by mattrobenolt

comment:1 Changed 3 years ago by mattrobenolt

  • Cc mattrobenolt added
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

Also, to add: this problem didn't exist in 1.2.

comment:2 Changed 3 years ago by mattrobenolt

  • Component changed from contrib.auth to Core (Other)
  • Has patch unset
  • Patch needs improvement set

Actually, I retract my patch to fix the issue. It just masks it and unveils more issues for model testing. It appears that the problem is much more deep rooted than this and may require a design decision since I'm not sure why certain decisions were made on certain aspects in the first place. Specifically why the internal app_store cache is stored based on relative package names and not absolute.

comment:3 Changed 3 years ago by julien

  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

comment:5 Changed 3 years ago by aaugustin

  • Easy pickings unset
  • Resolution set to duplicate
  • Status changed from new to closed
  • UI/UX unset

This looks suspiciously similar to #16283, which was fixed since then.

Please reopen if your problem isn't fixed in trunk.

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.