Reputation: 1815
I have a form on a page:
<form id="create_event" method="post" action="{% url app.views.create_event course.id %}" >
{% csrf_token %}
{{ eventForm.as_p }}
<input type="submit" value="add event">
</form>
And in my urls.py I have
(r'^item/(?P<item_id>\w+)/create_event/$', create_event),
(r'^item/(?P<item_id>\w+)/$', item),
I have both the functions create_event and item working on my localhost.
However, for some reason when I press submit on the form my server side (1.2.3 on webfaction, I'm stuck with using 1.2.3) django throws the following error:
Page not found (404)
Request Method: GET
Request URL: http://my_url/item/1/create_event/app.views.course
When I replaced the {% url app.views.create_event course_id %} with a hard coded URL it still somehow appended the method name to the URL. Could this be a problem with 1.2.3 not yet having some of the functionality I'm used to using from 1.3?
Any ideas?
Upvotes: 0
Views: 300
Reputation: 16796
Try changing your urls to:
(r'^item/(?P<item_id>\w+)/$', item, name='item'),
Then change your redirect in create_event
to:
return redirect('item', item_id = item_id)
Upvotes: 2