Easier Django form field output with django-widget-tweaks

This is a pretty cool app I've used in a recent project: https://pypi.python.org/pypi/django-widget-tweaks

When you want to render a form but don't want to mess around with rewriting the whole Widget subclass or mangle form rendering just to make text field 100% wide just set a class on it (for Bootstrap):

1
{{ form.field|add_class:"form-control" }}

Or say a textarea that's way too small?

1
{{ form.text|attr:"rows:20"|attr:"cols:20"|attr:"title:Hello, world!" }}

Some stuff you're still better off putting in CSS:

1
textarea#formfield { resize: 'vertical'; }

It's worth having a poke around the docs -- there's some pretty cool things there.