This commit is contained in:
Raphael Michel
2022-11-28 10:21:41 +01:00
parent add240a7b9
commit 0a30fa70da

View File

@@ -80,7 +80,7 @@ class CompatibleCountryField(serializers.Field):
country = self.countries.by_name(force_str(data))
if not country:
self.fail("invalid_choice", input=data)
return {self.field_name: country}
return {self.field_name: Country(country)}
def to_representation(self, instance: InvoiceAddress):
if instance.country: