]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/admin.py
add the feed request exclude parameters as an argument of the question_list view...
[osqa.git] / forum / views / admin.py
index 696bf665689d3cfa05c37f76ef0aca16d34a5502..6dffa5120a9add77f5f1dc97d651da2512a14c08 100644 (file)
@@ -33,7 +33,7 @@ def super_user_required(fn):
 
 def staff_user_required(fn):
     def wrapper(request, *args, **kwargs):
-        if request.user.is_authenticated() and request.user.is_staff:
+        if request.user.is_authenticated() and (request.user.is_staff or request.user.is_superuser):
             return fn(request, *args, **kwargs)
         else:
             return HttpResponseUnauthorized(request)
@@ -54,7 +54,7 @@ def admin_page_wrapper(fn, request, *args, **kwargs):
             'form', 'moderation', 'css', 'headandfoot', 'head', 'view', 'urls')]
             , lambda s1, s2: s1.weight - s2.weight)
 
-    context['tools'] = TOOLS
+    context['tools'] = [(name, fn.label) for name, fn in TOOLS.items()]
 
     unsaved = request.session.get('previewing_settings', {})
     context['unsaved'] = set([getattr(settings, s).set.name for s in unsaved.keys() if hasattr(settings, s)])
@@ -401,6 +401,12 @@ def edit_page(request, id=None):
     'published': published
     })
 
+@admin_page
+def delete_page(request, id=None):
+    page = get_object_or_404(Page, id=id)
+    page.delete()
+    return HttpResponseRedirect(reverse('admin_static_pages'))
+
 @admin_tools_page(_('createuser'), _("Create new user"))
 def create_user(request):
     if request.POST: