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 | ||||
|     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) | ||||
| 
 | ||||
|     if (voucher_form.is_valid() and | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Joel Addison
						Joel Addison