示例#1
0
            class CommentForm(Form):
                email = TextField(
                    _("Email"),
                    validators=[
                        required(message=_("Email required")),
                        email(message=_("A valid email is required"))
                    ])

                nickname = TextField(
                    _("Nickname"),
                    validators=[required(message=_("Nickname required"))])

                website = TextField(
                    _("Website"),
                    validators=[
                        optional(),
                        url(message=_("A valid url is required"))
                    ])

                comment = TextAreaField(
                    _("Comment"),
                    validators=[required(message=_("Comment required"))])

                captcha = TextField(
                    _("Captcha"),
                    validators=[required(message=_("Captcha required"))])

                submit = SubmitField(_("Add comment"))
                cancel = SubmitField(_("Cancel"))
示例#2
0
            class LinkForm(Form):
                name = TextField(
                    _("Site name"),
                    validators=[required(message=_("Site name required"))])

                link = TextField(
                    _("link"),
                    validators=[url(message=_("A valid url is required"))])

                email = TextField(
                    _("Email"),
                    validators=[email(message=_("A valid email is required"))])

                logo = TextField(_("Logo"),
                                 validators=[
                                     optional(),
                                     url(message=_("A valid url is required"))
                                 ])

                description = TextAreaField(_("Description"))

                submit = SubmitField(_("Save"))