forked from CGM_Public/pretix_original
Invoice model: Do not crash on invalid states
This commit is contained in:
@@ -157,9 +157,12 @@ class Invoice(models.Model):
|
|||||||
state_name = self.invoice_to_state
|
state_name = self.invoice_to_state
|
||||||
if str(self.invoice_to_country) in COUNTRIES_WITH_STATE_IN_ADDRESS:
|
if str(self.invoice_to_country) in COUNTRIES_WITH_STATE_IN_ADDRESS:
|
||||||
if COUNTRIES_WITH_STATE_IN_ADDRESS[str(self.invoice_to_country)][1] == 'long':
|
if COUNTRIES_WITH_STATE_IN_ADDRESS[str(self.invoice_to_country)][1] == 'long':
|
||||||
state_name = pycountry.subdivisions.get(
|
try:
|
||||||
code='{}-{}'.format(self.invoice_to_country, self.invoice_to_state)
|
state_name = pycountry.subdivisions.get(
|
||||||
).name
|
code='{}-{}'.format(self.invoice_to_country, self.invoice_to_state)
|
||||||
|
).name
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
parts = [
|
parts = [
|
||||||
self.invoice_to_company,
|
self.invoice_to_company,
|
||||||
|
|||||||
Reference in New Issue
Block a user