forked from CGM_Public/pretix_original
* [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,11 @@
|
||||
import json
|
||||
from decimal import Decimal
|
||||
|
||||
import dateutil.parser
|
||||
import pytz
|
||||
from django.dispatch import receiver
|
||||
from django.utils import formats
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||
from i18nfield.strings import LazyI18nString
|
||||
|
||||
@@ -200,6 +203,21 @@ def pretixcontrol_logentry_display(sender: Event, logentry: LogEntry, **kwargs):
|
||||
if logentry.action_type.startswith('pretix.event.tickets.provider.'):
|
||||
return _('The settings of a ticket output provider have been changed.')
|
||||
|
||||
if logentry.action_type == 'pretix.control.views.checkin':
|
||||
dt = dateutil.parser.parse(data.get('datetime'))
|
||||
tz = pytz.timezone(sender.settings.timezone)
|
||||
dt_formatted = date_format(dt.astimezone(tz), "SHORT_DATETIME_FORMAT")
|
||||
|
||||
if data.get('first'):
|
||||
return _('Position #{posid} has been checked in manually at {datetime}.').format(
|
||||
posid=data.get('positionid'),
|
||||
datetime=dt_formatted
|
||||
)
|
||||
return _('Position #{posid} has been checked in again at {datetime}.').format(
|
||||
posid=data.get('positionid'),
|
||||
datetime=dt_formatted
|
||||
)
|
||||
|
||||
if logentry.action_type == 'pretix.team.member.added':
|
||||
return _('{user} has been added to the team.').format(user=data.get('email'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user