Merge remote-tracking branch 'origin/master' into add_tests_to_shop

This commit is contained in:
Víðir Valberg Guðmundsson 2018-04-24 18:12:10 +02:00
commit d8871b871f
5 changed files with 56 additions and 1 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='')

View file

@ -5,7 +5,6 @@ from psycopg2.extras import DateTimeTZRange
from .factories import (
ProductFactory,
OrderFactory,
OrderProductRelationFactory,
)