Commits

Ian George  committed 7b6851d

Changed order form so 3rd address field is optional

  • Participants
  • Parent commits ed4f16b

Comments (0)

Files changed (3)

File quiet/shop/config.py

     vat_include = conf.ConfigBoolean(False, description='Prices include VAT')
     vat_show = conf.ConfigBoolean(True, description='Show VAT in basket and checkout')
     international = conf.ConfigBoolean(False, description='Allow international orders')
+    address3 = conf.ConfigBoolean(True, description='Show a third address field on the order page')

File quiet/shop/forms/order.py

     last_name = forms.CharField(label="Last name", required=True)
     address1 = forms.CharField(label="Address 1")
     address2 = forms.CharField(required=False, label="Address 2")
-    address3 = forms.CharField(required=False, label="Address 3")
+    if config.shop.address3:
+        address3 = forms.CharField(required=False, label="Address 3")
     city = forms.CharField(label="City")
     county = forms.CharField(required=False, label="County")
     if config.shop.international:
     delivery_last_name = forms.CharField(label="Last name", required=False)
     delivery_address1 = forms.CharField(required=False, label="Address 1")
     delivery_address2 = forms.CharField(required=False, label="Address 2")
-    delivery_address3 = forms.CharField(required=False, label="Address 3")
+    if config.shop.address3:
+        delivery_address3 = forms.CharField(required=False, label="Address 3")
     delivery_city = forms.CharField(required=False, label="City")
     delivery_county = forms.CharField(required=False, label="County")
     if config.shop.international:

File quiet/shop/views/order.py

             a_billing.name = "%s %s" % (form.cleaned_data['first_name'], form.cleaned_data['last_name'])
             a_billing.address1 = form.cleaned_data['address1']
             a_billing.address2 = form.cleaned_data['address2']
-            a_billing.address3 = form.cleaned_data['address3']
+            if config.shop.address3:
+                a_billing.address3 = form.cleaned_data['address3']
             a_billing.city = form.cleaned_data['city']
             a_billing.county = form.cleaned_data['county']
             a_billing.postcode = form.cleaned_data['postcode']
                 a_delivery.name = "%s %s" % (form.cleaned_data['delivery_first_name'], form.cleaned_data['delivery_last_name'])
                 a_delivery.address1 = form.cleaned_data['delivery_address1']
                 a_delivery.address2 = form.cleaned_data['delivery_address2']
-                a_delivery.address3 = form.cleaned_data['delivery_address3']
+                if config.shop.address3:
+                    a_delivery.address3 = form.cleaned_data['delivery_address3']
                 a_delivery.city = form.cleaned_data['delivery_city']
                 a_delivery.county = form.cleaned_data['delivery_county']
                 a_delivery.postcode = form.cleaned_data['delivery_postcode']