Opened 16 years ago

Closed 7 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 16 years ago.
default_admin_site_override_2.diff (1.9 KB ) - added by oyvind 16 years ago.
another possible solution
8500.1.diff (3.8 KB ) - added by Jannis Leidel 15 years ago.
updated patch from #8572 by msaelices

Download all attachments as: .zip

Change History (19)

by oyvind, 16 years ago

comment:2 by oyvind, 16 years ago

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

by oyvind, 16 years ago

another possible solution

comment:3 by Brian Rosner, 16 years ago

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 by oyvind, 16 years ago

Agree that the patch #8572 is better

comment:5 by Alex Gaynor, 16 years ago

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

comment:7 by Jannis Leidel, 15 years ago

milestone: 1.2
Triage Stage: Design decision neededAccepted

by Jannis Leidel, 15 years ago

Attachment: 8500.1.diff added

updated patch from #8572 by msaelices

comment:9 by James Bennett, 15 years ago

milestone: 1.2

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

comment:10 by Luke Plant, 14 years ago

Severity: Normal
Type: New feature

comment:11 by patchhammer, 14 years ago

Easy pickings: unset
Patch needs improvement: set

8500.1.diff fails to apply cleanly on to trunk

comment:12 by tinodb, 13 years ago

Cc: tinodb added
UI/UX: unset

comment:13 by Mikhail Korobov, 13 years ago

Cc: kmike84@… added

comment:15 by Raffaele Salmaso, 8 years ago

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 8 years ago by Raffaele Salmaso (previous) (diff)

comment:16 by Tim Graham, 8 years ago

Patch needs improvement: unset

comment:17 by Raffaele Salmaso, 8 years ago

Cc: raffaele.salmaso+djangoproject@… added

comment:18 by Carlton Gibson, 7 years ago

Triage Stage: AcceptedReady for checkin

comment:19 by Tim Graham <timograham@…>, 7 years ago

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