Constructing a wtforms\' TextAreaField is something like this:
content = wtf.TextAreaField(\'Content\', id=\"content-area\", validators=[validators.Required()])
You could simply use this replacement widget that is remembering default values for the rendering:
import wtforms.widgets.core
class TextArea(wtforms.widgets.core.TextArea):
def __init__(self, **kwargs):
self.kwargs = kwargs
def __call__(self, field, **kwargs):
for arg in self.kwargs:
if arg not in kwargs:
kwargs[arg] = self.kwargs[arg]
return super(TextArea, self).__call__(field, **kwargs)
Now you can add this new widget to your Field:
content = wtf.TextAreaField(
'Content',
id='content-area',
widget=TextArea(rows=50,cols=100),
validators=[validators.Required()])
You now can render this field without any extra arguments and get a 50x100 textarea.