@super_user_required
def wrapper(request, *args, **kwargs):
res = fn(request, *args, **kwargs)
- if isinstance(res, tuple):
- template, context = res
- context['basetemplate'] = settings.DJSTYLE_ADMIN_INTERFACE and "osqaadmin/djstyle_base.html" or "osqaadmin/base.html"
- context['allsets'] = Setting.sets
- context['othersets'] = sorted(
- [s for s in Setting.sets.values() if not s.name in
- ('basic', 'users', 'email', 'paths', 'extkeys', 'repgain', 'minrep', 'voting', 'accept', 'badges', 'about', 'faq', 'sidebar',
- 'form', 'moderation', 'css', 'headandfoot', 'head', 'view', 'urls')]
- , lambda s1, s2: s1.weight - s2.weight)
-
- context['tools'] = TOOLS
-
- unsaved = request.session.get('previewing_settings', {})
- context['unsaved'] = set([getattr(settings, s).set.name for s in unsaved.keys() if hasattr(settings, s)])
-
- return render_to_response(template, context, context_instance=RequestContext(request))
- else:
+ if isinstance(res, HttpResponse):
return res
+ template, context = res
+ context['basetemplate'] = settings.DJSTYLE_ADMIN_INTERFACE and "osqaadmin/djstyle_base.html" or "osqaadmin/base.html"
+ context['allsets'] = Setting.sets
+ context['othersets'] = sorted(
+ [s for s in Setting.sets.values() if not s.name in
+ ('basic', 'users', 'email', 'paths', 'extkeys', 'repgain', 'minrep', 'voting', 'accept', 'badges', 'about', 'faq', 'sidebar',
+ 'form', 'moderation', 'css', 'headandfoot', 'head', 'view', 'urls')]
+ , lambda s1, s2: s1.weight - s2.weight)
+
+ context['tools'] = TOOLS
+
+ unsaved = request.session.get('previewing_settings', {})
+ context['unsaved'] = set([getattr(settings, s).set.name for s in unsaved.keys() if hasattr(settings, s)])
+
+ return render_to_response(template, context, context_instance=RequestContext(request))
+
return wrapper
def admin_tools_page(name, label):
def decorator(fn):
+ fn = admin_page(fn)
fn.label = label
TOOLS[name] = fn