How to specify rows and columns of a <textarea > tag using wtforms

前端 未结 9 1909
暗喜
暗喜 2021-02-18 22:40

Constructing a wtforms\' TextAreaField is something like this:

content = wtf.TextAreaField(\'Content\', id=\"content-area\", validators=[validators.Required()])
         


        
9条回答
  •  别跟我提以往
    2021-02-18 23:09

    I looked at the code and found that Field class defines both __new__ and __init__. __new__ takes a bunch of *args and **kargs. So, you can just pass rows=x cols=y in your TextAreadField creation and it should work. I noticed that wtforms is creating a class called "UnboundField" for such cases, I don't know the implications of that as where this would cause problems, if any. But the next step of creating the TextAreaField are same. (That is control goes to __init__ call as before.)

提交回复
热议问题