django: Use a text area in your form

0 Comments

It was just one of those days when I stumbled upon this little gotcha.

I was a bit baffled when my textarea field would not show up on the form.

1.class YourForm(forms.Form):
2.  name = forms.CharField(maxlength = 20)
3. 
4.  # Textarea done WRONG
5.  #address = forms.Textarea()
6. 
7.  # Textarea done right!
8.  address = forms.CharField(widget = forms.widgets.Textarea())

A simple mistake and a little tricky to figure out because it fails silently.

Sparta
THIS IS SPARTA DJANGO!

[ Source ]

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog