title: django redirect to form view and autofill with previously entered values
body: <p>I have following scenario.</p>
  <ol>
  <li>User fills out a form</li>
  <li>If the user clicks the &quot;continue&quot; button and the form is valid the user will be redirected to a summary view</li>
  <li>In the summary view the user checks the input again. He can either continue or go back.</li>
  <li>If he continues the data will be saved in the database, if he goes back he can edit the form.</li>
  </ol>
  <p>Since in step 4 the user is at the view <code>summary</code> I have to redirect him to the <code>home</code> view. I don´t want the user to fill out the entire form again, the previously entered data should be autofilled if he goes back.</p>
  <p>Something special: I am using <a href="https://github.com/gojuukaze/django-tagify2" rel="nofollow noreferrer">django-tagify2</a> for one input in the form to get tags rather then text. If the user goes back the tags should be rendered correctly in the tagify specific form.</p>
  <p>So here are my files:</p>
  <p>home.html</p>
  <pre><code>{% extends &quot;messenger/base.html&quot; %}
  {% load crispy_forms_tags %}
  {% block content %}
      &lt;div class=&quot;message-container&quot;&gt;
      &lt;form method=&quot;POST&quot; autocomplete=&quot;off&quot;&gt;
          {% csrf_token %}
          {{ form|crispy }}
          &lt;button name=&quot;sendmessage&quot; class=&quot;btn btn-outline-info&quot; type=&quot;submit&quot;&gt;Continue&lt;/button&gt;
      &lt;/form&gt;
      &lt;/div&gt;
  {% endblock content %}
  </code></pre>
  <p>summary.html</p>
  <pre><code>{% extends &quot;messenger/base.html&quot; %}
  {% block content %}
      &lt;h4&gt;Zusammenfassung&lt;/h4&gt;
      &lt;p&gt;&lt;b&gt;Empfänger: &lt;/b&gt;{{ receiver }}&lt;/p&gt;
      &lt;br&gt;
      &lt;p&gt;&lt;b&gt;Betreff: &lt;/b&gt;{{ subject }}&lt;/p&gt;
      &lt;br&gt;
      &lt;p&gt;&lt;b&gt;Nachricht: &lt;/b&gt;{{ message }}&lt;/p&gt;
      &lt;button&gt;&lt;a href=&quot;/&quot;&gt;Edit&lt;/a&gt;&lt;/button&gt;
      &lt;button&gt;&lt;a href=&quot;/send_message&quot;&gt;Continue&lt;/a&gt;&lt;/button&gt;
  {% endblock content %}
  </code></pre>
  <p>home view</p>
  <pre><code>@login_required(login_url='login')
  def home(request):
      if request.method == 'POST' and 'sendmessage' in request.POST:
          message_form = MessageForm(request.POST)
          if message_form.is_valid():
              receiver_list = message_form['receiver'].value().split(';')
              subject = message_form['subject'].value()
              message = message_form['textmessage'].value()
  
              #create sessions and send data to next view
              session_receiver = receiver_list
              request.session['session_receiver'] = session_receiver
              session_subject = subject
              request.session['session_subject'] = session_subject
              session_message = message
              request.session['session_message'] = session_message
  
  
              return redirect('summary')
  
  
  
  
      else:
          message_form = MessageForm()
  
      return render(request, 'messenger/home.html', {'form': message_form})
  </code></pre>
  <p>summary view</p>
  <pre><code>def summary(request):
      receiver = request.session.get('session_receiver')
      subject = request.session.get('session_subject')
      message = request.session.get('session_message')
  
      return render(request, 'messenger/summary.html', {'receiver':receiver,
                                                        'subject':subject,
                                                        'message':message})
  </code></pre>
  <p>So what is the best way to do this?
  Can I use the session variables to set the fields in the form?</p>
  <p>I don´t want to change the logic in the app. I want a home/summary/success view/template where I can loop as long is I want between home and summary until the user is happy with his entered form data</p>