--- /dev/null
+{% load extra_tags %}
+<div class='post-update-info'>
+ {{ action.describe|safe }}
+ at
+ {{ action.action_date }}
+</div>
\ No newline at end of file
<ul>
<li><a href="{% url admin_maintenance %}">{% trans "Maintenance mode" %}</a></li>
</ul>
+ <ul>
+ <li><a href="{% url admin_flagged_posts %}">{% trans "Flagged Posts" %}</a></li>
+ </ul>
</div>
</div>
</div>
--- /dev/null
+{% extends basetemplate %}
+
+{% load i18n %}
+{% load user_tags %}
+
+{% block subtitle %}{% trans "Flagged Posts" %}{% endblock %}
+{% block pagename %}{% trans "Flagged Posts" %}{% endblock %}
+{% block description %}{% trans "This are the posts that have been flagged by users." %}{% endblock %}
+
+{% block admincontent %}
+ <div class="module" style="width:98%; display: inline-block;">
+ <table width="100%">
+ <caption>{% trans "Flagged Posts" %}</caption>
+ <tr>
+ <td colspan="2">
+ <table width="100%">
+ {% for post in flagged_posts %}
+ <tr><td>{% flagged_item post request.user %}</td></tr>
+ {% endfor %}
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+{% endblock %}
\ No newline at end of file
return ActivityNode(activity, viewer)\r
\r
\r
+@register.tag\r
+def flagged_item(parser, token):\r
+ try:\r
+ tag_name, post, viewer = token.split_contents()\r
+ except ValueError:\r
+ raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" % token.contents.split()[0]\r
+\r
+ return ActivityNode(post, viewer)\r
+\r
+\r
@register.inclusion_tag('users/menu.html')\r
def user_menu(request, user):\r
return dict(viewer=request.user, user=user)\r
url(r'^%s%s$' % (_('admin/'), _('go_defaults/')), app.admin.go_defaults, name="admin_go_defaults"),
url(r'^%s%s(?P<set_name>\w+)/(?P<var_name>\w+)/$' % (_('admin/'), _('settings/')), app.admin.get_default, name="admin_default"),
url(r'^%s%s$' % (_('admin/'), _('maintenance/')), app.admin.maintenance, name="admin_maintenance"),
+ url(r'^%s%s$' % (_('admin/'), _('flagged_posts/')), app.admin.flagged_posts, name="admin_flagged_posts"),
url(r'^%s%s(?P<set_name>\w+)/$' % (_('admin/'), _('settings/')), app.admin.settings_set, name="admin_set"),
from django.template import RequestContext
from django.utils.translation import ugettext as _
from django.utils import simplejson
-from django.db.models import Sum
-
+from django.db.models import Sum, Q, Count
from forum.settings.base import Setting
from forum.settings.forms import SettingsSetForm, MaintenanceModeForm
-from forum.models import Question, Answer, User, Node, Action
+from forum.models import Question, Answer, User, Node, Action, base
from forum import settings
def super_user_required(fn):
'settings_pack': unicode(settings.SETTINGS_PACK),
'statistics': get_statistics(),
'recent_activity': get_recent_activity(),
+ 'flagged_posts': get_flagged_posts(),
})
@super_user_required
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(),
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(),
+ })
+
+