diff --git a/app/api/schema/discount_codes.py b/app/api/schema/discount_codes.py index 166ec50915..7a25d28f04 100644 --- a/app/api/schema/discount_codes.py +++ b/app/api/schema/discount_codes.py @@ -86,7 +86,7 @@ def validate_quantity(self, data, original_data): DiscountCodeSchemaEvent.quantity_validation_helper(data) - if 'tickets_number' in data and 'max_quantity' in data: + if data.get('tickets_number') and data.get('max_quantity'): if data['tickets_number'] < data['max_quantity']: raise UnprocessableEntity({'pointer': '/data/attributes/tickets-number'}, "tickets-number should be greater than max-quantity") @@ -149,7 +149,7 @@ def validate_quantity(self, data, original_data): DiscountCodeSchemaTicket.quantity_validation_helper(data) - if 'tickets_number' in data and 'max_quantity' in data: + if data.get('tickets_number') and data.get('max_quantity'): if data['tickets_number'] < data['max_quantity']: raise UnprocessableEntity({'pointer': '/data/attributes/tickets-number'}, "tickets-number should be greater than max-quantity")