registrasion/views.py
def voucher_code(request):
    ''' A view *just* for entering a voucher form. '''

    VOUCHERS_FORM_PREFIX = "vouchers"

    # Handle the voucher form *before* listing products.
    # Products can change as vouchers are entered.
    v = _handle_voucher(request, VOUCHERS_FORM_PREFIX)
    voucher_form, voucher_handled = v

    if voucher_handled:
        messages.success(request, "Your voucher code was accepted.")
        return redirect("dashboard")

    data = {
        "voucher_form": voucher_form,
    }

    return render(request, "registrasion/voucher_code.html", data)
def voucher_code(request):
    ''' A view *just* for entering a voucher form. '''

    VOUCHERS_FORM_PREFIX = "vouchers"

    # Handle the voucher form *before* listing products.
    # Products can change as vouchers are entered.
    v = _handle_voucher(request, VOUCHERS_FORM_PREFIX)
    voucher_form, voucher_handled = v

    if voucher_handled:
        messages.success(request, "Your voucher code was accepted.")
        return redirect("dashboard")

    data = {
        "voucher_form": voucher_form,
    }

    return render(request, "registrasion/voucher_code.html", data)
A view *just* for entering a voucher form.