[Answered ]-Django Form Submission Error

0👍

Using {% url %} tag is the proper way to do. Your problem can also be solved by adding a forward slash / to the action attribute like this:

<form action="/user" method="post" >

Hope this helps!

2👍

I’d recommend putting in an action using the url template tag. With that, you will know for certain where the form is going to end up:

<form action="{% url 'user-url-name' %}" method="post">

The url tag will be an absolute url. Without this, you’re going to end up at a relative url depending on where in your application the user submits the form, which can be quite confusing during development and not entirely correct.

👤brianz

Leave a comment