#9127 closed (invalid)
admin.autodiscover() fails in certain structures
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | autodiscover, fails, admin, folder | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Take the following structure:
projectfolder
-> modules
-> app1
admin/
admin.py
-> app2
admin/
admin.py
settings.py
urls.py
Admin.autodiscover() as far as I know uses imp.find_module('admin', app_path), which seems to result in looking for an init.py inside the "admin/" folders of the apps, which I need for custom admin views, instead of directly using "admin.py" from the apps.
Change History (4)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Ah yeah, and the problem is, that those apps with "admin/" folders inside of them don't get displayed in the admin page.
comment:3 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
this is simply how python import behavior works - project/appname/admin.py
is identical to project/appname/admin/__init__.py
- both would be project.appname.admin
for an import
I should've used preformattedText for the folder structure. Here it is: