1👍
You need to give your button a name
attribute. You can post two forms on a single page by checking the name of the button pressed. This can be done like so:
Technique 1
...
if form.is_valid():
if "button1" in request.POST:
# do things for form 1
elif "button2" in request.POST:
# do things for form 2
...
Technique 2
Change the name
attribute of the hidden field depending on whether you are looking at country
or interest
.
You’re also not using jQuery with Django the way that it could best be done. As in, you’re not using the views.py
or the forms.py
files when submitting the information. Take a look at this answer for using jQuery and Django: How to use JQuery and Django (ajax + HttpResponse)?
0👍
Try setting DEBUG to True in the settings and look at the result 404 page through the console (or Firebug); the 404 error might not be caused by a missing URL but by the view rejecting the input, and the debug information could help in pinpointing the reason.
A possible cause might be whatever code is populating the value of <input id="country-tag-input">
. If the id becomes interest-tag-input
, that might cause the tag’s value not to be set, thereby sending an empty tagname to Django.
- [Answer]-Django project console management + Coding in Eclipse
- [Answer]-Add values to empty ModelForm
- [Answer]-Django modifying code under dist-packages v/s copying source to project folder