librelist archives

« back to archive

Understanding WTForms

Understanding WTForms

From:
Gamesbrainiac
Date:
2013-07-13 @ 09:59
Hi!

I am right now going through the Flask Mega

Tutorial<http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms>,
I was hoping that someone would be able to explain WTForm's text-field. I
need some help with this code <https://dpaste.de/Hbsrc/>.

Could one please explain as to why the first parameter is the same as the
name of the variable, what exactly is required in the first parameter. A
link to the relevant documentation would also be helpful.

-- 
Kind Regards,

Quazi Nafiul Islam

Re: [flask] Understanding WTForms

From:
Philippe Ndiaye
Date:
2013-07-13 @ 10:10
Hi !

About the first parameter of the text-field (and many other fields, btw),
represent the label of your field. In the tutorial, the fact that it's set
to the variable name is completely arbitrary. It could be:

    openid = TextField('Your awesome openid', validators=[Required()])

and if you want to display the field label in your web page form, it will
be equal to "Your awesome openid"

The relevant documentation belong here:
http://wtforms.simplecodes.com/docs/1.0.4/fields.html (Documentation on
Flask-WTF website doens't explain the fields and some other stuffs.)


On Sat, Jul 13, 2013 at 11:59 AM, Gamesbrainiac <gamesbrainiac@gmail.com>wrote:

> Hi!
>
> I am right now going through the Flask Mega 
Tutorial<http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms>,
> I was hoping that someone would be able to explain WTForm's text-field. I
> need some help with this code <https://dpaste.de/Hbsrc/>.
>
> Could one please explain as to why the first parameter is the same as the
> name of the variable, what exactly is required in the first parameter. A
> link to the relevant documentation would also be helpful.
>
> --
> Kind Regards,
>
> Quazi Nafiul Islam
>



-- 
*Philippe Thécou NDIAYE*
IT Student @ SUPINFO Lyon
Sysadmin Linux & Python programmer

Re: [flask] Understanding WTForms

From:
Gamesbrainiac
Date:
2013-07-13 @ 10:16
Thanks Phillipe! :D I see you're a Naruto fan. Glad to see like minded
anime lovers in Flask society. Again, thanks for your help.


On 13 July 2013 16:10, Philippe NDIAYE <phndiaye@gmail.com> wrote:

> Hi !
>
> About the first parameter of the text-field (and many other fields, btw),
> represent the label of your field. In the tutorial, the fact that it's set
> to the variable name is completely arbitrary. It could be:
>
>     openid = TextField('Your awesome openid', validators**=[Required()])
>
> and if you want to display the field label in your web page form, it will
> be equal to "Your awesome openid"
>
> The relevant documentation belong here:
> http://wtforms.simplecodes.com/docs/1.0.4/fields.html (Documentation on
> Flask-WTF website doens't explain the fields and some other stuffs.)
>
>
> On Sat, Jul 13, 2013 at 11:59 AM, Gamesbrainiac <gamesbrainiac@gmail.com>wrote:
>
>> Hi!
>>
>> I am right now going through the Flask Mega 
Tutorial<http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms>,
>> I was hoping that someone would be able to explain WTForm's text-field. I
>> need some help with this code <https://dpaste.de/Hbsrc/>.
>>
>> Could one please explain as to why the first parameter is the same as the
>> name of the variable, what exactly is required in the first parameter. A
>> link to the relevant documentation would also be helpful.
>>
>> --
>> Kind Regards,
>>
>> Quazi Nafiul Islam
>>
>
>
>
> --
> *Philippe Thécou NDIAYE*
> IT Student @ SUPINFO Lyon
> Sysadmin Linux & Python programmer
>



-- 
Kind Regards,

Quazi Nafiul Islam

Re: [flask] Understanding WTForms

From:
Philippe Ndiaye
Date:
2013-07-13 @ 10:27
You're welcome :D
Yes, i'm a Naruto fan, that shonen manga is just AWESOME !


On Sat, Jul 13, 2013 at 12:16 PM, Gamesbrainiac <gamesbrainiac@gmail.com>wrote:

> Thanks Phillipe! :D I see you're a Naruto fan. Glad to see like minded
> anime lovers in Flask society. Again, thanks for your help.
>
>
> On 13 July 2013 16:10, Philippe NDIAYE <phndiaye@gmail.com> wrote:
>
>> Hi !
>>
>> About the first parameter of the text-field (and many other fields, btw),
>> represent the label of your field. In the tutorial, the fact that it's set
>> to the variable name is completely arbitrary. It could be:
>>
>>     openid = TextField('Your awesome openid', validators**=[Required()])
>>
>> and if you want to display the field label in your web page form, it will
>> be equal to "Your awesome openid"
>>
>> The relevant documentation belong here:
>> http://wtforms.simplecodes.com/docs/1.0.4/fields.html (Documentation on
>> Flask-WTF website doens't explain the fields and some other stuffs.)
>>
>>
>> On Sat, Jul 13, 2013 at 11:59 AM, Gamesbrainiac <gamesbrainiac@gmail.com>wrote:
>>
>>> Hi!
>>>
>>> I am right now going through the Flask Mega 
Tutorial<http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms>,
>>> I was hoping that someone would be able to explain WTForm's text-field. I
>>> need some help with this code <https://dpaste.de/Hbsrc/>.
>>>
>>> Could one please explain as to why the first parameter is the same as
>>> the name of the variable, what exactly is required in the first parameter.
>>> A link to the relevant documentation would also be helpful.
>>>
>>> --
>>> Kind Regards,
>>>
>>> Quazi Nafiul Islam
>>>
>>
>>
>>
>> --
>> *Philippe Thécou NDIAYE*
>> IT Student @ SUPINFO Lyon
>> Sysadmin Linux & Python programmer
>>
>
>
>
> --
> Kind Regards,
>
> Quazi Nafiul Islam
>



-- 
Regards,
*
*
*Philippe Thécou NDIAYE*
IT Student @ SUPINFO Lyon
Linux Sysadmin  & Python programmer