title: how do i set radio button as checked based on database values in django template?
body: <p>here is my html code</p>
  
  <pre><code>&lt;input type="radio" name="cast" id="open" style="margin-left:10px;text-align:left;" value="Open" {% if data.cast %}checked{% endif %} required&gt;Open
                      &lt;input type="radio" name="cast" id="sebc" style="margin-left:10px;text-align:left;" value="SEBC" {% if data.cast %}checked{% endif %} required&gt;SEBC
                      &lt;input type="radio" name="cast" id="sc/st" style="margin-left:10px;text-align:left;" value="SC/ST" {% if data.cast %}checked{% endif %} required&gt;SC / ST
                      &lt;input type="radio" name="cast" id="other" style="margin-left:10px;text-align:left;" value="Other" {% if data.cast %}checked{% endif %} required&gt;Other
  </code></pre>
  
  <p>I did this but it didn't work for me.
  the <code>data.cast</code> is variable having database value.                        </p>