mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
API: Minor robustness improvements in quota and checkinlist serializers
This commit is contained in:
@@ -60,7 +60,7 @@ class CheckinListSerializer(I18nAwareModelSerializer):
|
|||||||
full_data = self.to_internal_value(self.to_representation(self.instance)) if self.instance else {}
|
full_data = self.to_internal_value(self.to_representation(self.instance)) if self.instance else {}
|
||||||
full_data.update(data)
|
full_data.update(data)
|
||||||
|
|
||||||
for item in full_data.get('limit_products'):
|
for item in full_data.get('limit_products', []):
|
||||||
if event != item.event:
|
if event != item.event:
|
||||||
raise ValidationError(_('One or more items do not belong to this event.'))
|
raise ValidationError(_('One or more items do not belong to this event.'))
|
||||||
|
|
||||||
|
|||||||
@@ -1697,7 +1697,7 @@ class Quota(LoggedModel):
|
|||||||
if event != item.event:
|
if event != item.event:
|
||||||
raise ValidationError(_('One or more items do not belong to this event.'))
|
raise ValidationError(_('One or more items do not belong to this event.'))
|
||||||
if item.has_variations:
|
if item.has_variations:
|
||||||
if not any(var.item == item for var in variations):
|
if not variations or not any(var.item == item for var in variations):
|
||||||
raise ValidationError(_('One or more items has variations but none of these are in the variations list.'))
|
raise ValidationError(_('One or more items has variations but none of these are in the variations list.'))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user