Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#8572 closed (duplicate)

Improve flexibility of admin.autodiscover for custom admin sites

Reported by: Manuel Saelices Owned by: Manuel Saelices
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

admin.autodiscover is great, but you cannot customize admin sites. It would be wonderful that you can call autodiscover with a optional site parameter, like this:

# urls.py

from django.contrib import admin

from yourproject.admin import custom_admin_site

admin.autodiscover(site=custom_admin_site)

urlpatterns = patterns('',
    ...
    ('^admin/(.*)', custom_admin_site.root),

I will attach a patch that implement that feature, without backwards incompatibility

Attachments (2)

autodiscover_improvement_r8596.diff (3.3 KB) - added by Manuel Saelices 8 years ago.
autodiscover_improvement_r8596.2.diff (3.7 KB) - added by Manuel Saelices 8 years ago.
I've missing to modify django.contrib.sites.admin

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Manuel Saelices

Changed 8 years ago by Manuel Saelices

I've missing to modify django.contrib.sites.admin

comment:1 Changed 8 years ago by Julien Phalip

I'm +1 on this. At the moment I'm using an ugly workaround to achieve the same thing:

admin.autodiscover()
custom_admin_site = admin.site

comment:2 Changed 8 years ago by Brian Rosner

Resolution: duplicate
Status: newclosed

This is a duplicate of #8500. I think this approach is better, but it is best to keep this all in one place.

comment:3 Changed 8 years ago by Manuel Saelices

@brosner, this approach is #8500 aproach or #8572 one?

comment:4 Changed 8 years ago by Manuel Saelices

I think this ticket approach permit you to define two custom sites and call admin.autodiscover in a natural way:

admin.autodiscover(site1)
admin.autodiscover(site2)

comment:5 Changed 8 years ago by Manuel Saelices

@brosner, sorry I didn't see your comment at #8500. You referred that this patch maybe would be better.

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