Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. class YourForm(forms.Form):
  2. your_field = forms.BooleanField(initial=True)
  3.  
  4. class MyForm(forms.Form):
  5. your_field = forms.BooleanField()
  6.  
  7. def __init__(self, *args, **kwargs):
  8. super(MyForm, self).__init__(*args, **kwargs)
  9. self.fields['your_field'].initial = True
  10.  
  11. form = MyForm(initial={'your_field': True})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement