Opened 17 years ago
Closed 8 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)
Change History (19)
by , 17 years ago
| Attachment: | default_admin_site_override.diff added |
|---|
comment:2 by , 17 years ago
| Summary: | Allow overridimg of default adminsite. → Allow overriding of default adminsite. |
|---|
by , 17 years ago
| Attachment: | default_admin_site_override_2.diff added |
|---|
comment:3 by , 17 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
Marked #8572 as a duplicate. I think that approach might be better, but certainly a post-1.0 thing.
comment:5 by , 17 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 , 16 years ago
| milestone: | → 1.2 |
|---|---|
| Triage Stage: | Design decision needed → Accepted |
comment:9 by , 16 years ago
| milestone: | 1.2 |
|---|
1.2 is feature-frozen, moving this feature request off the milestone.
comment:10 by , 15 years ago
| Severity: | → Normal |
|---|---|
| Type: | → New feature |
comment:11 by , 15 years ago
| Easy pickings: | unset |
|---|---|
| Patch needs improvement: | set |
8500.1.diff fails to apply cleanly on to trunk
comment:12 by , 14 years ago
| Cc: | added |
|---|---|
| UI/UX: | unset |
comment:13 by , 14 years ago
| Cc: | added |
|---|
comment:15 by , 9 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.
comment:16 by , 9 years ago
| Patch needs improvement: | unset |
|---|
comment:17 by , 9 years ago
| Cc: | added |
|---|
comment:18 by , 8 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
another possible solution