I have a view called edit_order, and I have another view called client_items.
def edit_order(request, order_no)
change_item = order.contact.client
def client_items(request, client_id = 0):
client = None
items = None
try:
client = models.Client.objects.get(pk = client_id)
items = client.storageitem_set.all()
except:
return HttpResponse(reverse(return_clients))
return render_to_response('items.html', {'items':items, 'client':client}, context_instance = RequestContext(request))
And in my edit order template I have a template tag url.
<input type="button" value="Edit items" onclick="window.location.href='{% url tiptop.views.client_items change_item.pk %}'" />
This works. Now, I want to make another view which does the same but can use an order_no parameter. But for some reason this does not work. I have called this view test_items.
def test_items(request, client_id = 0, order_no=0):
client = None
items = None
try:
client = models.Client.objects.get(pk = client_id)
items = client.storageitem_set.all()
order = models.Order.objects.get(pk = order_no)
except:
return HttpResponse(reverse(return_clients))
return render_to_response('test.html', {'items':items, 'client':client, 'order':order}, context_instance = RequestContext(request))
And in my template I have changed the url to this.
<input type="button" value="Edit items" onclick="window.location.href='{% url tiptop.views.test_items change_item.pk %}'" />
So I get this error.
Caught NoReverseMatch while rendering: Reverse for 'tiptop.views.test_items' with arguments '(17L,)' and keyword arguments '{}' not found.
The reason why this is causing this is the order_no parameter. But I want to be able to use this parameter. Is there a way I can overcome this issue? I hope this all made sense.