Commits

Ian George committed f8cef09

Made postcode non-validated if international shipping is available

  • Participants
  • Parent commits 2117d9d

Comments (0)

Files changed (1)

quiet/shop/forms/order.py

     county = forms.CharField(required=False, label="County")
     if config.shop.international:
         country = forms.ChoiceField(label="Country", choices=COUNTRIES, initial="GBR")
-    postcode = forms.RegexField(label="Postcode", regex=r'^(([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2}))$', max_length=10, error_message=("Please enter a valid UK postcode")) 
+        postcode = forms.CharField(label="Postcode")
+    else:
+        postcode = forms.RegexField(label="Postcode", regex=r'^(([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2}))$', max_length=10, error_message=("Please enter a valid UK postcode")) 
 
     delivery_telephone = forms.CharField(required=False, label="Telephone")
     delivery_email = forms.EmailField(required=False, label="Email")
     delivery_county = forms.CharField(required=False, label="County")
     if config.shop.international:
         delivery_country = forms.ChoiceField(label="Country", choices=COUNTRIES, initial="GBR")
-    delivery_postcode = forms.RegexField(required=False, label="Postcode", regex=r'^(([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2}))$', max_length=10, error_message=("Please enter a valid UK postcode")) 
+        delivery_postcode = forms.CharField(required=False, label="Postcode")
+    else:
+        delivery_postcode = forms.RegexField(required=False, label="Postcode", regex=r'^(([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2}))$', max_length=10, error_message=("Please enter a valid UK postcode")) 
 
     #def clean(self):
     #    if gift_certificate: