Skip to content

Instantly share code, notes, and snippets.

@hseritt
Created February 25, 2017 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hseritt/da6010787dcd1995321baf0777396856 to your computer and use it in GitHub Desktop.
Save hseritt/da6010787dcd1995321baf0777396856 to your computer and use it in GitHub Desktop.
Form widget customizations
...
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