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.
- [Answered ]-Django ModelForm ManyToManyField isn't able to update selected values
- [Answered ]-App '\udccd' could not be found. Is it in INSTALLED_APPS?
- [Answered ]-Model person to be able to have 1 or more first names out of which one is primary
- [Answered ]-Unable to use user.username in base template
- [Answered ]-Django not redirecting to desired url after login
Source:stackexchange.com