diff --git a/overview.py b/overview.py index 609ae1a..3cd626b 100644 --- a/overview.py +++ b/overview.py @@ -3,6 +3,7 @@ import json from datetime import datetime, timedelta from django.conf import settings from minecraft_manager.models import Application, Player, Ticket, Warning, IP +from django.contrib.auth.models import User def overview_data(): @@ -62,4 +63,13 @@ def overview_data(): 'month': Player.objects.filter(last_seen__range=[month, now]).count() } + # Admin + data['resolved'] = [] + for user in User.objects.all().order_by('username'): + data['resolved'].append({ + 'active': user.is_active, + 'username': user.username, + 'tickets': Ticket.objects.filter(staff=user).count() + }) + return data diff --git a/templates/minecraft_manager/overview.html b/templates/minecraft_manager/overview.html index 24ff385..81fb092 100644 --- a/templates/minecraft_manager/overview.html +++ b/templates/minecraft_manager/overview.html @@ -6,6 +6,25 @@ {% endblock %} {% block section %}
+ {% if request.user.is_staff %} +
+
+

Admin Area

+
+
+

Resolved Tickets

+ {% for staff in data.resolved %} +

{% if staff.active %}Active{% else %}Inactive{% endif %} {{ staff.username }}: {{ staff.tickets }}

+ {% endfor %} +
+
+ +
+
+
+
+
+ {% endif %}

Applications: {{ data.total.application.all }}

diff --git a/templatetags/sidebar.py b/templatetags/sidebar.py index 8bae2c4..2060a43 100644 --- a/templatetags/sidebar.py +++ b/templatetags/sidebar.py @@ -17,7 +17,7 @@ def get_sidebar(current_app, request): ret = '
  •   Overview
  • '.format('class="active"' if current_app == 'overview' else "", reverse('overview')) ret += '
  •   Bans
  • '.format('class="active"' if current_app == 'ban' else '', reverse('ban')) - ret += '
  •   Alerts{}
  • '.format('class="active"' if current_app == 'alert' else '', reverse('alert'), unseen_html) + ret += '
  •   Alerts{}
  • '.format('class="active"' if current_app == 'alert' else '', reverse('alert'), unseen_html) # Models ret += '
  •   Applications
  • '.format('class="active"' if current_app == 'application' else '', reverse('application'))