views:

49

answers:

1

WTForms is a forms validation and rendering library for python web development

and i write this code to check two password is or not same :

from wtforms import Form, BooleanField, TextField, validators

class SignUpForm(Form):
    username     = TextField('Username', [validators.Length(min=4, max=25)])
    email = TextField('Email', [validators.Length(min=6, max=120), validators.Email()])
    password1 = PasswordField('Password1')
    password2 = PasswordField('Password2')

    def sameP(self):
        return self.password1 ==self.password2

but , i want to know : can WTForms do this themself .

thanks

+4  A: 

use wtforms.validators.EqualTo.

It took less than a minute to find this in TFM, having never used this library before.

Wooble
Is it just me, or is zjm getting worse all the time?
Adam Crossland