Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#12138 closed (invalid)

django.contrib.auth assumes all applications are hosted in their top level package

Reported by: tiberiu_ichim Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

File "django/contrib/auth/models.py", line 283, in get_profile has

app_label, model_name = settings.AUTH_PROFILE_MODULE.split('.')

What if I want my AUTH_PROFILE_MODULE to be

AUTH_PROFILE_MODULE = 'pinax.apps.basic_profiles.Profile'

Of course, it's not possible. Seems like a basic design mistake of that piece of code.

Change History (4)

comment:1 by Russell Keith-Magee, 15 years ago

Resolution: invalid
Status: newclosed

There's no design mistake here. You need to use AUTH_PROFILE_MODULE="basic_brofiles.Profile", since that is how Django's app index will identify the model. This is exactly what the documentation tells you to do.

comment:2 by tiberiu_ichim, 15 years ago

I appreciate the time taken to point me to the docs. Then, should the ticket be something like "Django only understand applications that are top level packages, not subpackages" ? Nevermind the concept of (setuptools) namespaces...

comment:3 by Carl Meyer, 15 years ago

No, because that's not true either. Your application would be in INSTALLED_APPS as "pinax.apps.basic_profiles" and your AUTH_PROFILE_MODULE would still be "basic_profiles.Profile". Please take support issues to the mailing list or IRC, not the bug tracker.

comment:4 by Adam Nelson, 15 years ago

Nonetheless, the OP has a point that the cryptic error message and no clear statement in the docs that AUTH_PROFILE_MODULE has to have one an only one dot are needlessly difficult to divine for a new Python programmer.

Note: See TracTickets for help on using tickets.
Back to Top