I have a form at /item/3/sell_offer/4/
with action="add_post/"
I expect it go to /item/3/sell_offer/4/add_post
The relevant urlpatterns are
(r'^item/(?P<item_id>\d+)/sell_offer/(?P<sell_offer_id>\d+)/$', views.sell_offer_page),
(r'^item/(?P<item_id>\d+)/sell_offer/(?P<sell_offer_id>\d+)/add_post/$', views.sell_offer_add_post),
and the view looks like..
def sell_offer_add_post(request, item_id, sell_offer_id):
p = request.POST
if p.has_key("body") and p["body"]:
post = SellOfferPost(sell_offer=SellOfferPost.objects.get(pk=sell_offer_id))
form = SellOfferPostForm(p, instance=post)
post = form.save()
post.save()
return HttpResponseRedirect(reverse('views.sell_offer_page', args=[item_id, sell_offer_id]))
I think post action doesn't actually find it's way to the view.
Below is the error message
Request Method: POST
Request URL: http://......:8000/item/1/sell_offer/4/add_post/
Django Version: 1.3.1
Exception Type: TypeError
Exception Value:
sell_offer_add_post() got an unexpected keyword argument 'item_id'
Exception Location: /usr/local/lib/python2.6/dist-packages/Django-1.3.1-py2.6.egg/django/core/handlers/base.py in get_response, line 111
What am I doing wrong here?