Opened 15 years ago

Closed 6 years ago

#8500 closed New feature (fixed)

Allow overriding of default adminsite.

Reported by: oyvind Owned by: oyvind
Component: contrib.admin Version: dev
Severity: Normal Keywords: override adminsite
Cc: tinodb, kmike84@…, raffaele.salmaso+djangoproject@… Triage Stage: Ready for checkin
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 15 years ago.
default_admin_site_override_2.diff (1.9 KB) - added by oyvind 15 years ago.
another possible solution
8500.1.diff (3.8 KB) - added by Jannis Leidel 14 years ago.
updated patch from #8572 by msaelices

Download all attachments as: .zip

Change History (19)

Changed 15 years ago by oyvind

comment:2 Changed 15 years ago by oyvind

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

Changed 15 years ago by oyvind

another possible solution

comment:3 Changed 15 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 15 years ago by oyvind

Agree that the patch #8572 is better

comment:5 Changed 15 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 14 years ago by Jannis Leidel

milestone: 1.2
Triage Stage: Design decision neededAccepted

Changed 14 years ago by Jannis Leidel

Attachment: 8500.1.diff added

updated patch from #8572 by msaelices

comment:9 Changed 14 years ago by James Bennett

milestone: 1.2

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

comment:10 Changed 12 years ago by Luke Plant

Severity: Normal
Type: New feature

comment:11 Changed 12 years ago by patchhammer

Easy pickings: unset
Patch needs improvement: set

8500.1.diff fails to apply cleanly on to trunk

comment:12 Changed 12 years ago by tinodb

Cc: tinodb added
UI/UX: unset

comment:13 Changed 11 years ago by Mikhail Korobov

Cc: kmike84@… added

comment:14 Changed 7 years ago by Raffaele Salmaso

comment:15 Changed 7 years 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 7 years ago by Raffaele Salmaso (previous) (diff)

comment:16 Changed 7 years ago by Tim Graham

Patch needs improvement: unset

comment:17 Changed 7 years ago by Raffaele Salmaso

Cc: raffaele.salmaso+djangoproject@… added

comment:18 Changed 6 years ago by Carlton Gibson

Triage Stage: AcceptedReady for checkin

comment:19 Changed 6 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In da3df5b8:

Fixed #8500 -- Allowed overriding the default admin site instance.

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