mirror of
https://github.com/pretix/pretix.git
synced 2026-09-13 16:14:40 +00:00
Check-in list export: ALlow to filter by status (#3424)
This commit is contained in:
@@ -21,12 +21,12 @@
|
|||||||
<span class="fa fa-flask"></span>
|
<span class="fa fa-flask"></span>
|
||||||
{% trans "Check-in simulator" %}
|
{% trans "Check-in simulator" %}
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url "control:event.orders.export" event=request.event.slug organizer=request.event.organizer.slug %}?identifier=checkinlistpdf&checkinlistpdf-list={{ checkinlist.pk }}"
|
<a href="{% url "control:event.orders.export" event=request.event.slug organizer=request.event.organizer.slug %}?identifier=checkinlistpdf&checkinlistpdf-list={{ checkinlist.pk }}{% if "status" in request.GET %}&checkinlistpdf-status={{ request.GET.status|urlencode }}{% endif %}"
|
||||||
class="btn btn-default" target="_blank">
|
class="btn btn-default" target="_blank">
|
||||||
<span class="fa fa-download"></span>
|
<span class="fa fa-download"></span>
|
||||||
{% trans "PDF" %}
|
{% trans "PDF" %}
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url "control:event.orders.export" event=request.event.slug organizer=request.event.organizer.slug %}?identifier=checkinlist&checkinlist-list={{ checkinlist.pk }}"
|
<a href="{% url "control:event.orders.export" event=request.event.slug organizer=request.event.organizer.slug %}?identifier=checkinlist&checkinlist-list={{ checkinlist.pk }}{% if "status" in request.GET %}&checkinlist-status={{ request.GET.status|urlencode }}{% endif %}"
|
||||||
class="btn btn-default" target="_blank">
|
class="btn btn-default" target="_blank">
|
||||||
<span class="fa fa-download"></span>
|
<span class="fa fa-download"></span>
|
||||||
{% trans "CSV" %}
|
{% trans "CSV" %}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import bleach
|
|||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.db.models import (
|
from django.db.models import (
|
||||||
Case, Exists, Max, OuterRef, Q, Subquery, Value, When,
|
Case, Exists, F, Max, OuterRef, Q, Subquery, Value, When,
|
||||||
)
|
)
|
||||||
from django.db.models.functions import Coalesce, NullIf
|
from django.db.models.functions import Coalesce, NullIf
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
@@ -99,6 +99,17 @@ class CheckInListMixin(BaseExporter):
|
|||||||
label=_('Only tickets requiring special attention'),
|
label=_('Only tickets requiring special attention'),
|
||||||
required=False
|
required=False
|
||||||
)),
|
)),
|
||||||
|
('status',
|
||||||
|
forms.ChoiceField(
|
||||||
|
label=_('Check-in status'),
|
||||||
|
choices=(
|
||||||
|
('', _('All attendees')),
|
||||||
|
('3', pgettext_lazy('checkin state', 'Checked in but left')),
|
||||||
|
('2', pgettext_lazy('checkin state', 'Present')),
|
||||||
|
('1', _('Checked in')),
|
||||||
|
('0', _('Not checked in')),
|
||||||
|
),
|
||||||
|
)),
|
||||||
('sort',
|
('sort',
|
||||||
forms.ChoiceField(
|
forms.ChoiceField(
|
||||||
label=_('Sort by'),
|
label=_('Sort by'),
|
||||||
@@ -171,6 +182,19 @@ class CheckInListMixin(BaseExporter):
|
|||||||
'answers', 'answers__question', 'addon_to__answers', 'addon_to__answers__question'
|
'answers', 'answers__question', 'addon_to__answers', 'addon_to__answers__question'
|
||||||
).select_related('order', 'item', 'variation', 'addon_to', 'order__invoice_address', 'voucher', 'seat')
|
).select_related('order', 'item', 'variation', 'addon_to', 'order__invoice_address', 'voucher', 'seat')
|
||||||
|
|
||||||
|
if form_data.get('status'):
|
||||||
|
s = form_data.get('status')
|
||||||
|
if s == '1':
|
||||||
|
qs = qs.filter(last_checked_in__isnull=False)
|
||||||
|
elif s == '2':
|
||||||
|
qs = qs.filter(pk__in=cl.positions_inside.values_list('pk'))
|
||||||
|
elif s == '3':
|
||||||
|
qs = qs.filter(last_checked_in__isnull=False).filter(
|
||||||
|
Q(last_checked_out__isnull=False) & Q(last_exit__gte=F('last_checked_in'))
|
||||||
|
)
|
||||||
|
elif s == '0':
|
||||||
|
qs = qs.filter(last_checked_in__isnull=True)
|
||||||
|
|
||||||
if not cl.all_products:
|
if not cl.all_products:
|
||||||
qs = qs.filter(item__in=cl.limit_products.values_list('id', flat=True))
|
qs = qs.filter(item__in=cl.limit_products.values_list('id', flat=True))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user