forms: reduce empty & readonly textareas to a single row (#26538)

This commit is contained in:
Frédéric Péters 2018-09-18 21:37:52 +02:00
parent 3af73aeb21
commit 7f5a866bfb
1 changed files with 2 additions and 0 deletions

View File

@ -174,6 +174,8 @@ def text_render_content(self):
attrs['cols'] = 72
if not attrs.get('rows'):
attrs['rows'] = 5
if attrs.get('readonly') and not self.value:
attrs['rows'] = 1
return (htmltag("textarea", name=self.name, **attrs) +
htmlescape(self.value or "") + htmltext("</textarea>"))
TextWidget.render_content = text_render_content