def __init__(self, request, step, data=None, initial=None, errors=None): OrderForm.__init__(self, request, step, data, initial, errors) is_first_step = step == checkout.CHECKOUT_STEP_FIRST is_last_step = step == checkout.CHECKOUT_STEP_LAST is_payment_step = step == checkout.CHECKOUT_STEP_PAYMENT # Get list of country names countries = make_choices(get_country_names_list()) if settings.SHOP_CHECKOUT_STEPS_SPLIT: if is_first_step: # Change country widgets to a Select widget self.fields["billing_detail_country"].widget = forms.Select(choices=countries) self.fields["billing_detail_country"].initial = settings.SHOP_DEFAULT_COUNTRY self.fields["shipping_detail_country"].widget = forms.Select(choices=countries) self.fields["shipping_detail_country"].initial= settings.SHOP_DEFAULT_COUNTRY if is_payment_step: # Make card number and cvv fields use the data encrypted widget self.fields["card_number"].widget = DataEncryptedTextInput() self.fields["card_ccv"].widget = DataEncryptedPasswordInput() else: # Change country widgets to a Select widget self.fields["billing_detail_country"].widget = forms.Select(choices=countries) self.fields["billing_detail_country"].initial = settings.SHOP_DEFAULT_COUNTRY self.fields["shipping_detail_country"].widget = forms.Select(choices=countries) self.fields["shipping_detail_country"].initial= settings.SHOP_DEFAULT_COUNTRY if settings.SHOP_PAYMENT_STEP_ENABLED: # Make card number and cvv fields use the data encrypted widget self.fields["card_number"].widget = DataEncryptedTextInput() self.fields["card_ccv"].widget = DataEncryptedPasswordInput()
def __init__(self, request, step, data=None, initial=None, errors=None): OrderForm.__init__(self, request, step, data, initial, errors) is_first_step = step == checkout.CHECKOUT_STEP_FIRST is_last_step = step == checkout.CHECKOUT_STEP_LAST is_payment_step = step == checkout.CHECKOUT_STEP_PAYMENT # Get list of country names countries = make_choices(get_country_names_list()) if settings.SHOP_CHECKOUT_STEPS_SPLIT: if is_first_step: # Change country widgets to a Select widget self.fields["billing_detail_country"].widget = forms.Select( choices=countries) self.fields[ "billing_detail_country"].initial = settings.SHOP_DEFAULT_COUNTRY self.fields["shipping_detail_country"].widget = forms.Select( choices=countries) self.fields[ "shipping_detail_country"].initial = settings.SHOP_DEFAULT_COUNTRY if is_payment_step: # Make card number and cvv fields use the data encrypted widget self.fields["card_number"].widget = DataEncryptedTextInput() self.fields["card_ccv"].widget = DataEncryptedPasswordInput() else: # Change country widgets to a Select widget self.fields["billing_detail_country"].widget = forms.Select( choices=countries) self.fields[ "billing_detail_country"].initial = settings.SHOP_DEFAULT_COUNTRY self.fields["shipping_detail_country"].widget = forms.Select( choices=countries) self.fields[ "shipping_detail_country"].initial = settings.SHOP_DEFAULT_COUNTRY if settings.SHOP_PAYMENT_STEP_ENABLED: # Make card number and cvv fields use the data encrypted widget self.fields["card_number"].widget = DataEncryptedTextInput() self.fields["card_ccv"].widget = DataEncryptedPasswordInput()