Commits

Hynek Cernoch  committed 1980c8e

Fixed initial state of RadioSelect button in PaymentMethodForm

The first option is selected initially (fixed), but only if no other initial
value has been customized by signal By default payment_methods_query.
(extended functionality)

  • Participants
  • Parent commits d51867a

Comments (0)

Files changed (1)

File satchmo/apps/payment/forms.py

                 order=order,
                 contact=self._contact
                 )
+        if self.fields['paymentmethod'].initial == None:
+            self.fields['paymentmethod'].initial = payment_choices[0][0]
         if len(payment_choices) == 1:
-            self.fields['paymentmethod'].widget = forms.HiddenInput(attrs={'value' : payment_choices[0][0]})
+            self.fields['paymentmethod'].widget = forms.HiddenInput()
         else:
-            self.fields['paymentmethod'].widget = forms.RadioSelect(attrs={'value' : payment_choices[0][0]})
+            self.fields['paymentmethod'].widget = forms.RadioSelect()
         self.fields['paymentmethod'].choices = payment_choices
 
     def clean(self):