Python wtforms.fields.StringField() Examples

The following are 4 code examples of wtforms.fields.StringField(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wtforms.fields , or try the search function .
Example #1
Source File: investigation.py    From yeti with Apache License 2.0 5 votes vote down vote up
def get_form(klass):
        """Gets the appropriate form for a given investigation"""
        form = model_form(klass, exclude=klass.exclude_fields)

        # An empty name is the same as no name
        form.name = WTFStringField(
            'Name', filters=[lambda name: name or None])

        form.created_by = WTFHiddenField(
            'created_by', default=current_user.username)

        form.tags = TagListField("Tags")

        return form 
Example #2
Source File: testauth.py    From evesrp with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def form(self):
        class TestLoginForm(Form):
            username = StringField(u'Username', validators=[InputRequired()])
            password = PasswordField(u'Password', validators=[InputRequired()])
            submit = SubmitField(u'Log In using {}'.format(self.name))
        return TestLoginForm 
Example #3
Source File: views.py    From incubator-superset with Apache License 2.0 5 votes vote down vote up
def sqlalchemy_uri_form_validator(_: _, field: StringField) -> None:
    """
        Check if user has submitted a valid SQLAlchemy URI
    """

    sqlalchemy_uri_validator(field.data, exception=ValidationError) 
Example #4
Source File: views.py    From incubator-superset with Apache License 2.0 5 votes vote down vote up
def certificate_form_validator(_: _, field: StringField) -> None:
    """
        Check if user has submitted a valid SSL certificate
    """
    if field.data:
        try:
            utils.parse_ssl_cert(field.data)
        except CertificateException as ex:
            raise ValidationError(ex.message)