Fix handling country=None in attendee profiles (#6309)

* Fix handling country=None in AttendeeProfile describe

* Update checkoutflow.py

* fix more occurences

* handle country=None in InvoiceAddress even if it is not allowed
This commit is contained in:
Richard Schreiber
2026-06-29 14:32:01 +02:00
committed by GitHub
parent 9d668af102
commit 4fb1748bf6
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -395,7 +395,7 @@ class AttendeeProfile(models.Model):
self.company,
self.street,
(self.zipcode or '') + ' ' + (self.city or '') + ' ' + (self.state_for_address or ''),
self.country.name,
self.country.name if self.country else None,
]
for a in self.answers:
value = a.get('value')
+2 -2
View File
@@ -1697,7 +1697,7 @@ class AbstractPosition(RoundingCorrectionMixin, models.Model):
self.company,
self.street,
(self.zipcode or '') + ' ' + (self.city or '') + ' ' + (self.state_for_address or ''),
self.country.name
self.country.name if self.country else ''
]
lines = [r.strip() for r in lines if r]
return '\n'.join(lines).strip()
@@ -3438,7 +3438,7 @@ class InvoiceAddress(models.Model):
self.name,
self.street,
(self.zipcode or '') + ' ' + (self.city or '') + ' ' + (self.state_for_address or ''),
self.country.name,
self.country.name if self.country else '',
self.vat_id,
self.custom_field,
self.internal_reference,
+2 -2
View File
@@ -1159,7 +1159,7 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
for a in addresses:
data = {
"_pk": a.pk,
"_country_for_address": a.country.name,
"_country_for_address": a.country.name if a.country else '',
"_state_for_address": a.state_for_address,
"_name": a.name,
"is_business": "business" if a.is_business else "individual",
@@ -1202,7 +1202,7 @@ class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
for p in profiles:
data = {
"_pk": p.pk,
"_country_for_address": p.country.name,
"_country_for_address": p.country.name if p.country else '',
"_state_for_address": p.state_for_address,
"_attendee_name": p.attendee_name,
}
@@ -90,7 +90,7 @@
<dt>{% trans "ZIP code and city" %}</dt>
<dd>{{ addr.zipcode }} {{ addr.city }}</dd>
<dt>{% trans "Country" %}</dt>
<dd>{{ addr.country.name }}</dd>
<dd>{{ addr.country.name|default_if_none:"" }}</dd>
{% if addr.state %}
<dt>{% trans "State" context "address" as state_label %}{{ COUNTRY_STATE_LABEL|getitem:addr.country.code|default:state_label }}</dt>
<dd>{{ addr.state_name }}</dd>