Q:

Django redirect() with additional parameters

Why is it that when I try to pass additional parameters, I get the error:
The below works fine! (Without parameters)
def first(request):
    return redirect('confirm')

def confirm(request):
    return render(request, 'template.html')

However this is what I need, which doesn't work as expected, and I get the error:

Reverse for 'confirm' with keyword arguments '{'email': 'email'}' not found. 1 pattern(s) tried: ['book/booking_confirmation/$']

def first(request):
    return redirect('confirm', email='some_email')

def confirm(request, email):
    return render(request, 'template.html', { 'email': email} )

urls.py
urlpatterns += [
    url(r'^booking_confirmation/$', views.confirm, name='confirm'),
]

A:

If you don't want to pass the email via the URL in the redirect, it may be easiest to store it in the session.
def first(request):
    request.session['email'] = 'some_email'
    return redirect('confirm')

def confirm(request):
    return render(request, 'template.html', {'email': request.session['email']})

