Fixes voucher handling form to not be compulsory

This commit is contained in:
Christopher Neugebauer 2016-03-23 19:36:54 +11:00
parent 7086ea8729
commit d50d6bac48
2 changed files with 2 additions and 2 deletions

View file

@ -61,5 +61,5 @@ class VoucherForm(forms.Form):
voucher = forms.CharField(
label="Voucher code",
help_text="If you have a voucher code, enter it here",
required=True,
required=False,
)

View file

@ -33,7 +33,7 @@ def product_category(request, category_id):
cat_form.disable_products_for_user(request.user)
voucher_form = forms.VoucherForm(request.POST, prefix=VOUCHERS_FORM_PREFIX)
if voucher_form.is_valid():
if voucher_form.is_valid() and voucher_form.cleaned_data["voucher"].strip():
# Apply voucher
# leave
voucher = voucher_form.cleaned_data["voucher"]