[Django]-Form action not working in django

4👍

You have a typo in your HTML: from instead of form.

You may realize this, but that code won’t really save anything. I’m not sure what blog you are following, but you would be better-off following the official Django tutorial in the documentation, then reading the forms docs.

1👍

You may need to change method to "POST" in your form.

<from method = "get" action="/wikicamp/{{page_name}}/save/">

to

<form method = "post" action="/wikicamp/{{page_name}}/save/">
👤Rohan

0👍

There are some spelling mistakes, such as from instead of form.
Also the form is malformed.

Change:

<a href="/wikicamp/{{page_name}}/save/">this is link to save</a>

to

<input type="submit" value="Save Page" />

And thirdly, change the method= "get"to method="POST".

The entire form should look like this

<form method = "POST" action="/wikicamp/{{page_name}}/save/">
{% csrf_token %}
    <textarea name = "content" rows="20" cols="60">
    {{content}}
    </textarea>
    <br/>
    <input type="submit" value="Save Page"/>
</form>

Also what @DanielRoseman said. But hey, it might come further down the road.

Leave a comment