mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
* [WIP] manual check-in of attendees This enables manual check-in of attendees. The post-code was heavily copied from the APIRedeemView of the pretixdroid, thus so far this seems to be working, but I have a few questions: The checkin-Objects generated by the pretixdroid-app have a nonce. Should the checkin object generated here have a nonce, too? Should the result of the check-in be noted in any other way than by the change of the status? * addressed review comments * implement unit test for manual checkin * fix style-issues * Slight layout change * Log who did the manual check-in * Improve unit test to check the result of the action
This commit is contained in:
committed by
Raphael Michel
parent
9213a40219
commit
1a894d71b8
@@ -1,8 +1,13 @@
|
||||
from django.contrib import messages
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import F, Prefetch, Q
|
||||
from django.db.models.functions import Coalesce
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.generic import ListView
|
||||
|
||||
from pretix.base.models import Checkin, Item, OrderPosition
|
||||
from pretix.base.models import Checkin, Item, Order, OrderPosition
|
||||
from pretix.control.permissions import EventPermissionRequiredMixin
|
||||
|
||||
|
||||
@@ -69,6 +74,31 @@ class CheckInView(EventPermissionRequiredMixin, ListView):
|
||||
or "subevent" in self.request.GET)
|
||||
return ctx
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
positions = OrderPosition.objects.select_related('item', 'variation', 'order', 'addon_to').filter(
|
||||
order__event=self.request.event,
|
||||
pk__in=request.POST.getlist('checkin')
|
||||
)
|
||||
|
||||
for op in positions:
|
||||
created = False
|
||||
if op.order.status == Order.STATUS_PAID:
|
||||
ci, created = Checkin.objects.get_or_create(position=op, defaults={
|
||||
'datetime': now(),
|
||||
})
|
||||
op.order.log_action('pretix.control.views.checkin', data={
|
||||
'position': op.id,
|
||||
'positionid': op.positionid,
|
||||
'first': created,
|
||||
'datetime': now()
|
||||
}, user=request.user)
|
||||
|
||||
messages.success(request, _('The selected tickets have been marked as checked in.'))
|
||||
return redirect(reverse('control:event.orders.checkins', kwargs={
|
||||
'event': self.request.event.slug,
|
||||
'organizer': self.request.event.organizer.slug
|
||||
}) + '?' + request.GET.urlencode())
|
||||
|
||||
@staticmethod
|
||||
def get_ordering_keys_mappings():
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user