From 74acfbe2fd465845c7d6c6c93330ec139414c705 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 2 Jul 2020 20:11:39 +0200 Subject: [PATCH] Fix issue with new pycountry version --- src/pretix/api/serializers/order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pretix/api/serializers/order.py b/src/pretix/api/serializers/order.py index 96a48f707..2c0417823 100644 --- a/src/pretix/api/serializers/order.py +++ b/src/pretix/api/serializers/order.py @@ -68,7 +68,7 @@ class InvoiceAddressSerializer(I18nAwareModelSerializer): data['name_parts']['_scheme'] = self.context['request'].event.settings.name_scheme if data.get('country'): - if not pycountry.countries.get(alpha_2=data.get('country')): + if not pycountry.countries.get(alpha_2=data.get('country').code): raise ValidationError( {'country': ['Invalid country code.']} ) @@ -600,7 +600,7 @@ class OrderPositionCreateSerializer(I18nAwareModelSerializer): data['attendee_name_parts']['_scheme'] = self.context['request'].event.settings.name_scheme if data.get('country'): - if not pycountry.countries.get(alpha_2=data.get('country')): + if not pycountry.countries.get(alpha_2=data.get('country').code): raise ValidationError( {'country': ['Invalid country code.']} )