Last active
December 18, 2015 10:59
-
-
Save inoshiro/5772360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from django import forms | |
>>> class CommentForm(forms.Form): | |
... name = forms.CharField(initial='class') | |
... | |
>>> f = CommentForm() | |
>>> print(f) | |
<tr><th><label for="id_name">Name:</label></th><td><input type="text" name="name" value="class" id="id_name" /></td></tr> | |
>>> f.fields['name'].initial | |
'class' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class CommentForm(forms.Form): | |
... name = forms.CharField() | |
... | |
>>> f = CommentForm() | |
>>> f.fields['name'].initial | |
>>> print(f.fields['name'].initial) | |
None | |
>>> name = f.fields['name'] | |
>>> f.initial | |
{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment