title: Django form keeps information after submission
body: <p>I have a Django form and I am trying different options to do 2 things when the form is submitted:</p>
  <ol>
  <li>Redirect the form back without any information</li>
  <li>Trigger a Modal after a Django Form is submitted.</li>
  </ol>
  <p>I have followed this <a href="https://stackoverflow.com/q/48327301/13176726">answer</a> but it did not work the form was successfully submitted but the modal did not appear.</p>
  <p>I have added the context of <code>successful_submit</code> in the views so that it can be triggered after submitting the form</p>
  <p>Here is part of the HTML Template:</p>
  <pre><code>          &lt;div class=&quot;text-center&quot;&gt;
              &lt;button
                class=&quot;btn btn-primary mt-5&quot;
                onclick=&quot;stepper1.previous()&quot;
              &gt;
                Previous
              &lt;/button&gt;
              &lt;button type=&quot;submit&quot; class=&quot;btn btn-success mt-5&quot;&gt;
                Submit
              &lt;/button&gt;
              &lt;button
                type=&quot;button&quot;
                class=&quot;btn btn-primary&quot;
                data-mdb-toggle=&quot;modal&quot;
                data-mdb-target=&quot;#exampleModal&quot;
              &gt;
                Launch demo modal
              &lt;/button&gt;
                &lt;!-- Modal --&gt;
                &lt;div
                  class=&quot;modal fade&quot;
                  id=&quot;exampleModal&quot;
                  tabindex=&quot;-1&quot;
                  aria-labelledby=&quot;exampleModalLabel&quot;
                  aria-hidden=&quot;true&quot;
                &gt;
                  &lt;div class=&quot;modal-dialog&quot;&gt;
                    &lt;div class=&quot;modal-content&quot;&gt;
                      &lt;div class=&quot;modal-header&quot;&gt;
                        &lt;h5 class=&quot;modal-title&quot; id=&quot;exampleModalLabel&quot;&gt;
                          Modal title
                        &lt;/h5&gt;
                        &lt;button
                          type=&quot;button&quot;
                          class=&quot;btn-close&quot;
                          data-mdb-dismiss=&quot;modal&quot;
                          aria-label=&quot;Close&quot;
                        &gt;&lt;/button&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;modal-body&quot;&gt;...&lt;/div&gt;
                      &lt;div class=&quot;modal-footer&quot;&gt;
                        &lt;button
                          type=&quot;button&quot;
                          class=&quot;btn btn-secondary&quot;
                          data-mdb-dismiss=&quot;modal&quot;
                        &gt;
                          Close
                        &lt;/button&gt;
                        &lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot;&gt;
                          Save changes
                        &lt;/button&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  </code></pre>
  <p>here is the javascript part to show it when it is successfully submitted</p>
  <pre><code>    {% if successful_submit %}
          &lt;script type=&quot;text/javascript&quot;&gt;
              $(document).ready(function(){
                  $(&quot;#exampleModal&quot;).modal('show');
              });
          &lt;/script&gt;
      {% endif %}
  </code></pre>
  <p>here is the views.py</p>
  <pre><code>def add__plan(request):
      if request.method == 'POST':
          # create a form instance and populate it with data from the request:
          form = infoForm(request.POST)
          # check whether it's valid:
          if form.is_valid():
              form.save()
              _name = form.cleaned_data.get('Name')
              messages.success(request, f'PDF created for {_name}!')
              # return redirect('plan:plan')
              # redirect(reverse('plan:plan', kwargs={'successful_submit': True}))
              return render(request, 'plan/plan.html', {'form': form, 'successful_submit': True})
  
      # if a GET (or any other method) we'll create a blank form
      else:
          form = infoForm()
          print(form.errors)
      return render(request, 'plan/plan.html', {'form': form, 'successful_submit': True })
  </code></pre>