Created
February 25, 2017 12:52
-
-
Save hseritt/da6010787dcd1995321baf0777396856 to your computer and use it in GitHub Desktop.
Form widget customizations
This file contains hidden or 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 ArticleAddForm(ModelForm): | |
""" | |
Form for creating a new article. | |
""" | |
content = forms.CharField(widget=forms.Textarea(attrs={'class': 'content_textarea'})) | |
project = forms.ModelChoiceField(queryset=Project.objects.all(), required=False) | |
class Meta: | |
model = Article | |
widgets = {'description': forms.Textarea(attrs={'rows':6, 'cols':89}),} | |
fields = [ | |
'title', 'audience', 'project', 'content', 'description', | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment