1. Ryan Wilcox
  2. appengine_form_utils


appengine_form_utils / text_area_widget.py

from google.appengine.ext.db import djangoforms

Make it REALLY easy to customize the cols and rows for your TextAreas!!!!

class TextAreaWidget(djangoforms.forms.Textarea):
    """TextAreaWidget: A big honking text area!. Pass rows and cols into the constructor and off you go!"""
    def __init__(self, rows, cols, *args, **kwargs):
        self.rows = rows
        self.cols = cols
        kwargs.setdefault('attrs',{}).update({'class': 'bigtext'})
        super(TextAreaWidget, self).__init__(*args, **kwargs)
    def render(self, name, value, attrs=None):
    	attrs["rows"] = self.rows
    	attrs["cols"] = self.cols
        out = super(TextAreaWidget, self).render(name, value, attrs)
        return out