title: How to set 'next' parameter via extra_context in Django
body: <p>I have an online e-commerce system.  If the user is not logged in when placing an order, this is the view that directs them to the three options presented to them in the template: login, signup, do neither and continue the order details page.</p>
  
  <p>I want to modify the url to which the user is redirected to should they choose to log in.  I want that url to be the order details page of the order they just made.</p>
  
  <p>As you can see, I grab the order ID from the session, build the url with the order ID, then pack it in an extra_context dictionary.</p>
  
  <pre><code>def loginorsignup(request):
      if 'user_just_ordered' not in request.session:
          return HttpResponseRedirect(urlresolvers.reverse('signup'))
  
      orderid = request.session['orderid']
      next = '/order/' + orderid
      extra_context = {'next': next}
  
      if request.method == 'POST':
          postdata = request.POST.copy()
          if postdata['submit'] == 'Login':
              return HttpResponseRedirect(urlresolvers.reverse('login', kwargs={'extra_context': extra_context}))
          if postdata['submit'] == 'Create New Account':
              return HttpResponseRedirect(urlresolvers.reverse('signup'))
          if postdata['submit'] == 'Not Now':
              return HttpResponseRedirect(urlresolvers.reverse('orderwithid', args=(orderid,)))
  
      return render(request, 'registration/loginorsignup.html', locals())
  </code></pre>
  
  <p>When I get to this point in the order process and click 'Login' I get this error:</p>
  
  <pre><code>NoReverseMatch at /users/loginorsignup/
  </code></pre>