43
Having an action of an empty string in most browsers points the form at the URL the browser currently has loaded, which is the script that served the form in the first place.
6
For an interesting insight on forms with empty actions read this thread, which gives you an updated HTML5-perspective on this matter.
- [Django]-Django and VirtualEnv Development/Deployment Best Practices
- [Django]-Django : Serving static files through nginx
- [Django]-Django Rest Framework update field
4
It’s also possible that javascript loaded with this page could be setting an action once the page is loaded based on what application is using the page.
Another likely possibility is that the javascript is handling the onsubmit event. One might do that to prevent the page from reloading or redirecting to a specific page
- [Django]-ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
- [Django]-How to delete old image when update ImageField?
- [Django]-Get object by field other than primary key
0
I guess it’s bit late to answer this post. Anyways, I’ll what I learnt about this.
If the “action” is not specified in forms, then the Django looks up the HttpResponseRedirect
in the corresponding view.
For example, in the example below:
if form.is_valid(): # All validation rules pass
# Process the data in form.cleaned_data
# ...
return HttpResponseRedirect('/thanks/')
Once, the form is validated (and processed), the page is redirected to ‘thanks’
- [Django]-Is_valid() vs clean() django forms
- [Django]-Logging requests to django-rest-framework
- [Django]-Images from ImageField in Django don't load in template