Opened 9 years ago

Last modified 2 weeks ago

#8500 new New feature

Allow overriding of default adminsite.

Reported by: oyvind Owned by: oyvind
Component: contrib.admin Version: master
Severity: Normal Keywords: override adminsite
Cc: tinodb, kmike84@…, raffaele.salmaso+djangoproject@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It would be great to be able to replace the default adminsite in settings.

For example, all contrib apps assume you use the default adminsite.

Would also make it easier for contrib app to just "snap in" another site to add functionality to the admim.

Attachments (3)

default_admin_site_override.diff (1.2 KB) - added by oyvind 9 years ago.
default_admin_site_override_2.diff (1.9 KB) - added by oyvind 9 years ago.
another possible solution
8500.1.diff (3.8 KB) - added by Jannis Leidel 7 years ago.
updated patch from #8572 by msaelices

Download all attachments as: .zip

Change History (17)

Changed 9 years ago by oyvind

comment:2 Changed 9 years ago by oyvind

Summary: Allow overridimg of default adminsite.Allow overriding of default adminsite.

Changed 9 years ago by oyvind

another possible solution

comment:3 Changed 9 years ago by Brian Rosner

Triage Stage: UnreviewedDesign decision needed

Marked #8572 as a duplicate. I think that approach might be better, but certainly a post-1.0 thing.

comment:4 Changed 9 years ago by oyvind

Agree that the patch #8572 is better

comment:5 Changed 9 years ago by Alex Gaynor

I'm not sure I understand the approach taken there, at present the admin.autodiscover() has no knowledge of the adminsite.

comment:7 Changed 7 years ago by Jannis Leidel

milestone: 1.2
Triage Stage: Design decision neededAccepted

Changed 7 years ago by Jannis Leidel

Attachment: 8500.1.diff added

updated patch from #8572 by msaelices

comment:9 Changed 7 years ago by James Bennett

milestone: 1.2

1.2 is feature-frozen, moving this feature request off the milestone.

comment:10 Changed 6 years ago by Luke Plant

Severity: Normal
Type: New feature

comment:11 Changed 6 years ago by patchhammer

Easy pickings: unset
Patch needs improvement: set

8500.1.diff fails to apply cleanly on to trunk

comment:12 Changed 6 years ago by tinodb

Cc: tinodb added
UI/UX: unset

comment:13 Changed 5 years ago by Mikhail Korobov

Cc: kmike84@… added

comment:14 Changed 6 months ago by Raffaele Salmaso

comment:15 Changed 6 months ago by Raffaele Salmaso

Hi, I usually override the default admin site with my custom version, then found this ticket, so I choose to complete it.

The first PR was using a new setting (ADMIN_SITE_CLASS), but I rewrote it to use a custom (Simple)AdminConfig and no new setting.
The idea is to delay site instance creation only to when needed with LazyObject, so django.apps can be fully loaded and can access the required attribute.
Using an helper function as the first patch cannot work because require a new setting, and we wanto to avoid that.
This version doesn't require to adapt current code with a

def register(site):
    ...

as the last patch require, or rewriting code not to use django.contrib.admin.sites.site directly.

Last edited 6 months ago by Raffaele Salmaso (previous) (diff)

comment:16 Changed 6 months ago by Tim Graham

Patch needs improvement: unset

comment:17 Changed 6 months ago by Raffaele Salmaso

Cc: raffaele.salmaso+djangoproject@… added
Note: See TracTickets for help on using tickets.
Back to Top