Skip to content

Instantly share code, notes, and snippets.

@jvorcak
Created October 16, 2019 06:15
Show Gist options
  • Save jvorcak/395e8705bf0031fe9a43669bc1d15aeb to your computer and use it in GitHub Desktop.
Save jvorcak/395e8705bf0031fe9a43669bc1d15aeb to your computer and use it in GitHub Desktop.
Submitting multiple forms in Django
<form action="" method="post">
{% csrf_token %}
{{ form.as_ul }}
<button type="submit" name="form_1">Submit</button>
</form>
<form action="" method="post">
{% csrf_token %}
{{ form.as_ul }}
<button type="submit" name="form_2">Submit</button>
</form>
views.py
'form_1' in request.POST
'form_2' in request.POST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment