id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux
2104,[patch] Make admin view methods wrappable by user views for non-staff,garthk@…,nobody,"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. ",enhancement,closed,contrib.admin,,normal,wontfix,,gary.wilson@…,Design decision needed,1,0,0,0,,