forked from CGM_Public/pretix_original
API: Add exclude parameter to check-in lists
This commit is contained in:
@@ -58,7 +58,7 @@ rules object Custom check-in
|
|||||||
|
|
||||||
.. versionchanged:: 3.11
|
.. versionchanged:: 3.11
|
||||||
|
|
||||||
The ``subevent_match`` filter has been added.
|
The ``subevent_match`` and ``exclude`` query parameters have been added.
|
||||||
|
|
||||||
Endpoints
|
Endpoints
|
||||||
---------
|
---------
|
||||||
@@ -114,6 +114,7 @@ Endpoints
|
|||||||
:query integer page: The page number in case of a multi-page result set, default is 1
|
:query integer page: The page number in case of a multi-page result set, default is 1
|
||||||
:query integer subevent: Only return check-in lists of the sub-event with the given ID
|
:query integer subevent: Only return check-in lists of the sub-event with the given ID
|
||||||
:query integer subevent_match: Only return check-in lists that are valid for the sub-event with the given ID (i.e. also lists valid for all subevents)
|
:query integer subevent_match: Only return check-in lists that are valid for the sub-event with the given ID (i.e. also lists valid for all subevents)
|
||||||
|
:query string exclude: Exclude a field from the output, e.g. ``checkin_count``. Can be used as a performance optimization. Can be passed multiple times.
|
||||||
:param organizer: The ``slug`` field of the organizer to fetch
|
:param organizer: The ``slug`` field of the organizer to fetch
|
||||||
:param event: The ``slug`` field of the event to fetch
|
:param event: The ``slug`` field of the event to fetch
|
||||||
:statuscode 200: no error
|
:statuscode 200: no error
|
||||||
|
|||||||
@@ -17,6 +17,17 @@ class CheckinListSerializer(I18nAwareModelSerializer):
|
|||||||
'include_pending', 'auto_checkin_sales_channels', 'allow_multiple_entries', 'allow_entry_after_exit',
|
'include_pending', 'auto_checkin_sales_channels', 'allow_multiple_entries', 'allow_entry_after_exit',
|
||||||
'rules')
|
'rules')
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
for exclude_field in self.context['request'].query_params.getlist('exclude'):
|
||||||
|
p = exclude_field.split('.')
|
||||||
|
if p[0] in self.fields:
|
||||||
|
if len(p) == 1:
|
||||||
|
del self.fields[p[0]]
|
||||||
|
elif len(p) == 2:
|
||||||
|
self.fields[p[0]].child.fields.pop(p[1])
|
||||||
|
|
||||||
def validate(self, data):
|
def validate(self, data):
|
||||||
data = super().validate(data)
|
data = super().validate(data)
|
||||||
event = self.context['event']
|
event = self.context['event']
|
||||||
|
|||||||
Reference in New Issue
Block a user