1

This is standard checkbox from model forms:

In my HTML I have: {{form}}

In website source:

<div class="id_accept-control-group control-group">
   <div class="controls">
      <label class="checkbox">
      <input type="checkbox" name="accept" id="id_accept" /> <span>Accept</span>
      </label>
   </div>
</div>

How to add custom attribute: disabled="disabled" checked="checked" (to input)?

webfanks
  • 391
  • 2
  • 3
  • 11

1 Answers1

3

Check out this question to point you in the right direction Django: How do I add arbitrary html attributes to input fields on a form?

Also take a look at the model forms django doc https://docs.djangoproject.com/en/dev/topics/forms/modelforms/

Community
  • 1
  • 1
Hacking Life
  • 3,335
  • 2
  • 19
  • 20