Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#8572 closed (duplicate)

Improve flexibility of admin.autodiscover for custom admin sites

Reported by: msaelices Owned by: msaelices
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 msaelices 6 years ago.
autodiscover_improvement_r8596.2.diff (3.7 KB) - added by msaelices 6 years ago.
I've missing to modify django.contrib.sites.admin

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by msaelices

Changed 6 years ago by msaelices

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

comment:1 Changed 6 years ago by julien

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 6 years ago by brosner

  • Resolution set to duplicate
  • Status changed from new to closed

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 6 years ago by msaelices

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

comment:4 Changed 6 years ago by msaelices

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 6 years ago by msaelices

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

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.