title: How to write checkbox in flask?
body: <p>I want to render a template.In the template, I have a checkbox called "IsValid", its value is from database. I want to read and edit the state of checkbox. After edit the checkbox, I want to store the its value in the database. How should I write the checkbox?</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label for="IsValid" class="control-label col-md-2"&gt;IsValid&lt;/label&gt;       
  &lt;div class="col-md-2"&gt;
      &lt;input type="checkbox" class="form-control" id="IsValid" name="IsValid" {{ checked="checked" if items[6]=1 else "" }} " &gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In the code, <strong>items[6]</strong> is passed by view function.It's value is from database, it has two values,0 and 1.</p>
  
  <p>How to modify <code>{{ checked="checked" if items[6]=1 else "" }}</code>?</p>
  
  <p>Because it is wrong. </p>
  
  <blockquote>
    <p>Wrong information:jinja2.exceptions.TemplateSyntaxError: expected
    token 'end of print statement', got '='</p>
  </blockquote>
  
  <p>I don't know if you can understand because my English is poor.</p>