diff --git a/src/backoffice/templates/approve_public_credit_names.html b/src/backoffice/templates/approve_public_credit_names.html new file mode 100644 index 00000000..0ed6beb8 --- /dev/null +++ b/src/backoffice/templates/approve_public_credit_names.html @@ -0,0 +1,42 @@ +{% extends 'base.html' %} +{% load commonmark %} +{% load static from staticfiles %} +{% load imageutils %} +{% block extra_head %} + + +{% endblock extra_head %} +{% block content %} +
+

Approve Public Credit Names

+
+ Use this view to approve users public credit names. +
+
+
+
+ + + + + + + + + + + {% for profile in profiles %} + + + + + + + {% endfor %} + +
UsernameEmailPublic Credit NameActions
{{ profile.user.username }}{{ profile.user.email }}{{ profile.public_credit_name }} + Open In Admin +
+
+{% endblock content %} + diff --git a/src/backoffice/templates/backoffice_index.html b/src/backoffice/templates/backoffice_index.html index 4fd2dad4..ad799924 100644 --- a/src/backoffice/templates/backoffice_index.html +++ b/src/backoffice/templates/backoffice_index.html @@ -26,6 +26,10 @@

Hand Out Badges

Use this view to mark badges as handed out.

+ +

Approve Public Credit Names

+

Use this view to check and approve users Public Credit Names

+
diff --git a/src/backoffice/urls.py b/src/backoffice/urls.py index e1af8680..e366e471 100644 --- a/src/backoffice/urls.py +++ b/src/backoffice/urls.py @@ -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'), ] diff --git a/src/backoffice/views.py b/src/backoffice/views.py index dfb3de69..e08ced5f 100644 --- a/src/backoffice/views.py +++ b/src/backoffice/views.py @@ -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='') + diff --git a/src/shop/tests.py b/src/shop/tests.py index 809f2a5e..f28ec463 100644 --- a/src/shop/tests.py +++ b/src/shop/tests.py @@ -5,7 +5,6 @@ from psycopg2.extras import DateTimeTZRange from .factories import ( ProductFactory, - OrderFactory, OrderProductRelationFactory, )