add a backoffice view to approve public credit names, fixes #217

This commit is contained in:
Thomas Steen Rasmussen 2018-04-22 08:28:46 +02:00
parent 99e6fa80c5
commit 9b2e164ddb
4 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,42 @@
{% extends 'base.html' %}
{% load commonmark %}
{% load static from staticfiles %}
{% load imageutils %}
{% block extra_head %}
<script src="{% static "js/jquery.dataTables.min.js" %}"></script>
<link rel="stylesheet" href="{% static 'css/jquery.dataTables.min.css' %}">
{% endblock extra_head %}
{% block content %}
<div class="row">
<h2>Approve Public Credit Names</h2>
<div class="lead">
Use this view to approve users public credit names.
</div>
</div>
<br>
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Public Credit Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for profile in profiles %}
<tr>
<td>{{ profile.user.username }}</td>
<td>{{ profile.user.email }}</td>
<td>{{ profile.public_credit_name }}</td>
<td>
<a href="/admin/profiles/profile/{{ profile.pk }}/change/" class="btn btn-success">Open In Admin</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}

View File

@ -26,6 +26,10 @@
<h4 class="list-group-item-heading">Hand Out Badges</h4>
<p class="list-group-item-text">Use this view to mark badges as handed out.</p>
</a>
<a href="{% url 'backoffice:public_credit_names' %}" class="list-group-item">
<h4 class="list-group-item-heading">Approve Public Credit Names</h4>
<p class="list-group-item-text">Use this view to check and approve users Public Credit Names</p>
</a>
</div>
</div>

View File

@ -9,5 +9,6 @@ urlpatterns = [
url(r'product_handout/$', ProductHandoutView.as_view(), name='product_handout'),
url(r'badge_handout/$', BadgeHandoutView.as_view(), name='badge_handout'),
url(r'ticket_checkin/$', TicketCheckinView.as_view(), name='ticket_checkin'),
url(r'public_credit_names/$', ApproveNamesView.as_view(), name='public_credit_names'),
]

View File

@ -2,6 +2,7 @@ from django.views.generic import TemplateView, ListView
from django.http import HttpResponseForbidden
from shop.models import OrderProductRelation
from tickets.models import ShopTicket, SponsorTicket, DiscountTicket
from profiles.models import Profile
from itertools import chain
import logging
logger = logging.getLogger("bornhack.%s" % __name__)
@ -44,3 +45,11 @@ class TicketCheckinView(StaffMemberRequiredMixin, ListView):
discounttickets = DiscountTicket.objects.filter(checked_in=False)
return list(chain(shoptickets, sponsortickets, discounttickets))
class ApproveNamesView(StaffMemberRequiredMixin, ListView):
template_name = "approve_public_credit_names.html"
context_object_name = 'profiles'
def get_queryset(self, **kwargs):
return Profile.objects.filter(public_credit_name_approved=False).exclude(public_credit_name='')