SHARE
TWEET

Untitled

a guest Jun 15th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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})
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top