django form: how to check out checkbox state in template

前端 未结 4 1689
情话喂你
情话喂你 2021-02-06 14:46

I have a form with checkboxes that works fine, but when the user submits the form with errors and my checkbox is checked I need to change div class which holds the checkbox. So

4条回答
  •  囚心锁ツ
    2021-02-06 15:16

    In models.py:

    class Article:
        published = BooleanField()
        (...)
    

    In the template:

     
    

提交回复
热议问题