Opened 19 years ago
Closed 18 years ago
#2104 closed enhancement (wontfix)
[patch] Make admin view methods wrappable by user views for non-staff
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | contrib.admin | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | gary.wilson@… | Triage Stage: | Design decision needed |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I'm trying to call admin views from my views to greatly simplify my code. My efforts are frustrated by this style of view definition in django.contrib.admin.views.main:
def useful_view_method(request): # ... useful_view_method = staff_member_required(usefulmethod)
Thanks to the wrapper, the method is useful only to the admin interface unless I make a copy of it. Such a copy is inefficient, error-prone, and requires checking each Django code update.
Making the unprotected view available as follows would let me wrap the view myself to whatever protection level I see fit:
def _useful_view_method(request):
# ...
useful_view_method = staff_member_required(_useful_view_method)
On a similar line of thinking: change_list needlessly insists on change permission. I'd like it to list regardless, as even mortals should be able to view the table I've got in mind. I can have my change_stage equivalent check permissions and then pass on to either a read-only view method or the "official" change_stage, at least once I can reach around the staff_member_required wrapper.
Attachments (1)
Change History (10)
by , 19 years ago
comment:1 by , 19 years ago
| Summary: | Admin view paranoia limits re-use → [patch] Make admin view methods wrappable by user views for non-staff |
|---|
comment:2 by , 19 years ago
| Type: | defect → enhancement |
|---|
comment:3 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:4 by , 19 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
comment:6 by , 19 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
I think it would be nice to be able to re-use some of the admin functionality in other places. The new admin options stuff being talked about will allow you to run multiple admin interface instances and use different authorization checks, so maybe that will fix this ticket.
comment:7 by , 19 years ago
| Cc: | added |
|---|
comment:8 by , 19 years ago
Control over the authorisation checks and URL would definitely help. Where is this "talked about"?
comment:9 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | reopened → closed |
The admin views are going away, to be replaced with a much more customizable AdminSite class.
[patch] permit wrapping of change_list et al