Allow voucher code to be passed in via query param
Voucher form now accepts a "voucher" query string parameter with the value to be pre-populated when the form is rendered.
This commit is contained in:
parent
5b93b39f67
commit
ad005a2fb2
1 changed files with 6 additions and 1 deletions
7
vendor/registrasion/registrasion/views.py
vendored
7
vendor/registrasion/registrasion/views.py
vendored
|
@ -650,7 +650,12 @@ def _handle_voucher(request, prefix):
|
||||||
''' Handles a voucher form in the given request. Returns the voucher
|
''' Handles a voucher form in the given request. Returns the voucher
|
||||||
form instance, and whether the voucher code was handled. '''
|
form instance, and whether the voucher code was handled. '''
|
||||||
|
|
||||||
voucher_form = forms.VoucherForm(request.POST or None, prefix=prefix)
|
initial = {}
|
||||||
|
if request.GET:
|
||||||
|
initial = request.GET.copy()
|
||||||
|
|
||||||
|
voucher_form = forms.VoucherForm(request.POST or None, prefix=prefix,
|
||||||
|
initial=initial)
|
||||||
current_cart = CartController.for_user(request.user)
|
current_cart = CartController.for_user(request.user)
|
||||||
|
|
||||||
if (voucher_form.is_valid() and
|
if (voucher_form.is_valid() and
|
||||||
|
|
Loading…
Reference in a new issue