]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/admin.py
took out some unnessisary imports.
[osqa.git] / forum / views / admin.py
index f154ea18fe1b7fe2d60fa13d086e7b81c9e92841..543623de31b16217396d1c54ec6c30647acd9ef2 100644 (file)
@@ -8,7 +8,6 @@ from django.template import RequestContext
 from django.utils.translation import ugettext as _
 from django.utils import simplejson
 from django.db.models import Sum
-
 from forum.settings.base import Setting
 from forum.settings.forms import SettingsSetForm, MaintenanceModeForm
 
@@ -49,6 +48,7 @@ def dashboard(request):
         'settings_pack': unicode(settings.SETTINGS_PACK),
         'statistics': get_statistics(),
         'recent_activity': get_recent_activity(),
+        'flagged_posts': get_flagged_posts(),
     })
 
 @super_user_required
@@ -142,6 +142,9 @@ def get_default(request, set_name, var_name):
 def get_recent_activity():
     return Action.objects.order_by('-action_date')[0:30]
 
+def get_flagged_posts():
+    return Action.objects.filter(action_type="flag").order_by('-action_date')[0:30]
+
 def get_statistics():
     return {
         'total_users': User.objects.all().count(),
@@ -273,3 +276,10 @@ def maintenance(request):
     return ('osqaadmin/maintenance.html', {'form': form, 'in_maintenance': settings.MAINTAINANCE_MODE.value is not None})
 
 
+@admin_page
+def flagged_posts(request):
+    return ('osqaadmin/flagged_posts.html', {
+        'flagged_posts': get_flagged_posts(),
+    })
+
+