I have four views redirecting from one to another and here is what am doing but the urls are not working out.

```
def show_item(request,id):
        a = Item.objects.get(pk=id)
        form = PartialOrderItemForm(request.POST,instance=a)
        # check validation of posted data
        if form.is_valid():
            order.add_to_order(request,a)
            url =urlresolvers.reverse('order_index',kwargs={'id':a.id})
            # redirect to order page
            return HttpResponseRedirect(url)
        ......
    return render_to_response('item.html',context,context_instance=RequestContext(request))

```

the above view redirects to this one below,

```
def show_order(request,id):
    item = Item.objects.get(pk=order_id)
    if request.method == 'POST':
        postdata = request.POST.copy()
        if postdata['submit'] == 'Remove':
            order.remove_from_order(request)
        if postdata['submit'] == 'Update':
            order.update_order(request)
        if postdata['submit'] == 'checkout':
            return HttpResponseRedirect(urlresolvers.reverse('checkout',kwargs={'id':order_id}))

```

`show_order` redirects to `show_checkout` below

```
def show_checkout(request,id):
    ......
    if request.method == 'POST':
        resto = Restaurant.objects.get(pk=id)
        postdata = request.POST.copy()
        form = forms.CheckoutForm(request.POST,postdata)
        if form.is_valid():
            order_created = create_order(request,resto)
            ....
            if postdata['submit'] == 'place order':
                reciept_url = urlresolvers.reverse('checkout_reciept')
                return HttpResponseRedirect(reciept_url)
    return render(request,'checkout/checkout.html',context)

```

urls.py,

```
url(r'^your_order/(\d+)/$',show_order,name="order_index"),
    url(r'^item/(?P<id>\d+)/$',show_item, name="item_order"),
    url(r'^checkout/(?P<id>\d+)/$',show_checkout,name="checkout"),

```

all this breaks at the first redirect giving error `NoReverseMatch`. I am not doing it right, a brief explanation on how i can build urls for search a scenario is very much accepted.

complete traceback of errors

```
Traceback:
File "/home/matsinvasion/projects/f4l/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/matsinvasion/projects/f4l/f4l/live/views.py" in show_item
  140.          url =urlresolvers.reverse('order_index',kwargs={'id':a.id})
File "/home/matsinvasion/projects/f4l/env/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse
  476.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/home/matsinvasion/projects/f4l/env/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
  396.                 "arguments '%s' not found." % (lookup_view_s, args, kwargs))

Exception Type: NoReverseMatch at /orders/item/3/
Exception Value: Reverse for 'order_index' with arguments '()' and keyword arguments '{'id': 3}' not found.

```

> 
> Fixing the problem as catherine suggests, results to exception DoesNotEXist at `Show_checkout`
> 
> 
> 

```
Traceback:
File "/home/matsinvasion/projects/f4l/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/matsinvasion/projects/f4l/f4l/live/views.py" in show_checkout
  59.       resto = Restaurant.objects.get(pk=id)
File "/home/matsinvasion/projects/f4l/env/local/lib/python2.7/site-packages/django/db/models/manager.py" in get
  131.         return self.get_query_set().get(*args, **kwargs)
File "/home/matsinvasion/projects/f4l/env/local/lib/python2.7/site-packages/django/db/models/query.py" in get
  366.                     % self.model._meta.object_name)

Exception Type: DoesNotExist at /orders/checkout/3/
Exception Value: Restaurant matching query does not exist

```

complete `checkout_view`

```
def show_checkout(request,id):
    """checkout form to collect order information"""
    if order.is_empty(request):
        cart_url = urlresolvers.reverse('order_index')
        return HttpResponseRedirect(cart_url)
    if request.method == 'POST':
        resto = Restaurant.objects.get(pk=id)
        postdata = request.POST.copy()
        form = forms.CheckoutForm(request.POST,postdata)
        if form.is_valid():
            order_created = create_order(request,resto)
            order_number = order_created.id
            if order_number:
                request.session['order_number'] = order_number
            if postdata['submit'] == 'place order':
                reciept_url = urlresolvers.reverse('checkout_reciept')
                return HttpResponseRedirect(reciept_url)
    else:
        form = forms.CheckoutForm
    context = {
        'form':form,
    }
    return render(request,'checkout/checkout.html',context)

```