mirror of
https://github.com/pretix/pretix.git
synced 2026-05-01 00:32:39 +00:00
API: Fix crash when passing an empty seat_category_mapping during event creation
This commit is contained in:
@@ -138,8 +138,11 @@ class EventSerializer(I18nAwareModelSerializer):
|
||||
return value
|
||||
|
||||
def validate_seat_category_mapping(self, value):
|
||||
if value and value['seat_category_mapping'] and (not self.instance or not self.instance.pk):
|
||||
raise ValidationError('You cannot specify seat category mappings on event creation.')
|
||||
if not self.instance or not self.instance.pk:
|
||||
if value and value['seat_category_mapping']:
|
||||
raise ValidationError('You cannot specify seat category mappings on event creation.')
|
||||
else:
|
||||
return {'seat_category_mapping': {}}
|
||||
item_cache = {i.pk: i for i in self.instance.items.all()}
|
||||
result = {}
|
||||
for k, item in value['seat_category_mapping'].items():
|
||||
|
||||
@@ -176,6 +176,7 @@ def test_event_create(token_client, organizer, event, meta_prop):
|
||||
"meta_data": {
|
||||
meta_prop.name: "Conference"
|
||||
},
|
||||
"seat_category_mapping": {},
|
||||
"timezone": "Europe/Amsterdam"
|
||||
},
|
||||
format='json'
|
||||
|
||||
Reference in New Issue
Block a user