title: Trigger bootstrap modal after django form submission
body: <p>How can I trigger the bootstrap modal to popup after my django form was submitted?</p>
  
  <p>In my index.html template I have a standard looking modal like this</p>
  
  <pre><code>&lt;div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"&gt;
          &lt;div class="modal-dialog" role="document"&gt;
            &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                &lt;h5 class="modal-title" id="exampleModalLabel"&gt;Modal title&lt;/h5&gt;
                &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;
                  &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
                &lt;/button&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                ...
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                &lt;button type="button" class="btn btn-secondary" data-dismiss="modal"&gt;Close&lt;/button&gt;
                &lt;button type="button" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  </code></pre>
  
  <p>below in the same index.html I have a django form</p>
  
  <pre><code>  {{ form.non_field_errors }}
                  {% csrf_token %}
                      &lt;ul id="robul"&gt;
                        &lt;div class="form-group"&gt;
                          &lt;div class="col-xs-6"&gt;
                          &lt;li id="name" name="{{ form.name.name }}" class="form-control"&gt;{{ form.name }}&lt;/li&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class="form-group"&gt;
                          &lt;div class="col-xs-6"&gt;
                          &lt;li id="email" class="form-control"&gt;{{ form.email }}&lt;/li&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                        &lt;div class="form-group"&gt;
                          &lt;div class="col-xs-6"&gt;
                          &lt;li id="contactmessage" class="form-control"&gt;{{ form.contactmessage }}&lt;/li&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;/ul&gt;
  </code></pre>
  
  <p>in my view.py it looks like this:</p>
  
  <pre><code>if request.method == 'POST':
          form = forms.FormName(request.POST)
  
          if form.is_valid():
              contact_name = request.POST.get(
                  'name', '')
              contact_email = request.POST.get(
                  'email', '')
              form_content = request.POST.get('contactmessage', '')
  
              template = get_template('contact_template.txt')
              context = {'name': contact_name,
              'email': contact_email,
              'contactmessage': form_content,}
              content = template.render(context)
              mail = EmailMessage("New contact form submission", content, "Some Name" +'', ['somegmail@gmail.com'],
              headers = {'Reply-To': "noreply@gmail.com" })
              mail.send()
      return render(request, 'index.html', {'form': form})
  </code></pre>