title: Remember radio button selection in Django
body: <p>Without using javascript, is there a better way to remember a user's radio button selection? I feel I have a pretty naive(?) way of doing it?</p>
  
  <p>How can I re-write this to make it more DRY? <code>usersegment</code> parem gets returned on the same page upon submit.</p>
  
  <pre><code>{% if usersegment == "non-paying" %}
  &lt;input type="radio" name="usersegment" value="non-paying" checked="yes"/&gt; Non-paying Users &lt;br /&gt;
  &lt;input type="radio" name="usersegment" value="paying" /&gt; Paying Users &lt;br /&gt;
  &lt;input type="radio" name="usersegment" value="all" /&gt; All Users&lt;br /&gt;
  {% endif %}
  
  {% if usersegment == "paying" %}
  &lt;input type="radio" name="usersegment" value="non-paying" /&gt; Non-paying Users &lt;br /&gt;
  &lt;input type="radio" name="usersegment" value="paying" checked="yes"/&gt; Paying Users &lt;br /&gt;
  &lt;input type="radio" name="usersegment" value="all" /&gt; All Users&lt;br /&gt;
  {% endif %}
  
  {% if usersegment == "all" or not usersegment %}
  &lt;input type="radio" name="usersegment" value="non-paying" checked="yes"/&gt; Non-paying Users &lt;br /&gt;
  &lt;input type="radio" name="usersegment" value="paying" /&gt; Paying Users &lt;br /&gt;
  &lt;input type="radio" name="usersegment" value="all" checked="yes"/&gt; All Users&lt;br /&gt;
  {% endif %} 
  </code></pre>