Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9127 closed (invalid)

admin.autodiscover() fails in certain structures

Reported by: panni@… 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 panni@…, 16 years ago

I should've used preformattedText for the folder structure. Here it is:

projectfolder
    -> modules
        -> app1/
            admin/ 
            admin.py

        -> app2/
            admin/ 
            admin.py

    settings.py 
    urls.py

comment:2 by panni@…, 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 Collin Grady, 16 years ago

Resolution: invalid
Status: newclosed

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

comment:4 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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