python - Seem to have a problem with returning an order.pk value with Django -
(r'^search/(?p<client_id>\d+)/(?p<order_no>\d+)/test_items/$', views.test_items),
i want link can go url views.service_order2, unfortunately, keep getting noreversematch error.
(r'^quote/service_order/(?p<client_id>\d+)/(?p<order_no>\d+)/(?p<request_type>\d+)/$', views.service_order2), caught noreversematch while rendering: reverse 'tiptop.views.service_order2' arguments '('', 17l, 1)' , keyword arguments '{}' not found
the problem seems order not have pk value. have done same procedure test_items view , worked out fine. why in 1 of views can return order.pk value, in (service_order2 view) can't question.
#views.py def service_order2(request, client_id = 0, order_no = 0, request_type = 1): # lot of code order=request.session['order'] return render_to_response('service_step1__2nd.html', {'contacts':contacts, 'addresses':addresses, 'title':title, 'service_list':service_list, 'date_type':date_type, 'address_type':address_type, 'order':order}, context_instance = requestcontext(request)) 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=request.session['order'] except: return httpresponse(reverse(return_clients)) return render_to_response('test.html', {'items':items, 'client':client, 'order':order}, context_instance = requestcontext(request))
in template called test.html, have template tag link written inside.
<input type="submit" value="request delivery" onclick="change_action('{% url tiptop.views.service_order2 order.pk client.pk 1 %}')"/>
from error message seems client_id empty.
Comments
Post a Comment