forked from CGM_Public/pretix_original
Fix bug when modifying an order with an address in a country with a state
This commit is contained in:
@@ -452,14 +452,17 @@ class BaseQuestionsForm(forms.Form):
|
||||
types, form = COUNTRIES_WITH_STATE_IN_ADDRESS[cc]
|
||||
statelist = [s for s in pycountry.subdivisions.get(country_code=cc) if s.type in types]
|
||||
c += sorted([(s.code[3:], s.name) for s in statelist], key=lambda s: s[1])
|
||||
state = (cartpos.state if cartpos else orderpos.state)
|
||||
elif fprefix + 'state' in self.data:
|
||||
self.data = self.data.copy()
|
||||
state = None
|
||||
del self.data[fprefix + 'state']
|
||||
|
||||
add_fields['state'] = forms.ChoiceField(
|
||||
label=pgettext_lazy('address', 'State'),
|
||||
required=False,
|
||||
choices=c,
|
||||
initial=state,
|
||||
widget=forms.Select(attrs={
|
||||
'autocomplete': 'address-level1',
|
||||
}),
|
||||
|
||||
@@ -343,7 +343,7 @@ var form_handlers = function (el) {
|
||||
$("select[name$=state]:not([data-static])").each(function () {
|
||||
var dependent = $(this),
|
||||
counter = 0,
|
||||
dependency = $(this).closest("form").find('select[name$=country]'),
|
||||
dependency = $(this).closest(".panel-body, form").find('select[name$=country]'),
|
||||
update = function (ev) {
|
||||
counter++;
|
||||
var curCounter = counter;
|
||||
|
||||
Reference in New Issue
Block a user