Skip to content

Instantly share code, notes, and snippets.

@nubela
Last active December 15, 2015 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nubela/5211542 to your computer and use it in GitHub Desktop.
Save nubela/5211542 to your computer and use it in GitHub Desktop.
Generating HTML forms with built-in client-side and backend validators.
def generate_login_form():
"""
Generates a traditional login form, bootstrap-styled.
DEV USE: Look at this function to figure out how to generate
forms
:return form_skeleton_obj:
"""
form = [
FormType.ALPHANUM(
"username",
label="Username",
placeholder="Your username here..",
validators=[FormValidator.REQUIRED, FormValidator.NOT_BLANK]
),
FormType.ALPHANUM(
"password",
label="Password",
validators=[FormValidator.REQUIRED, FormValidator.NOT_BLANK]
),
FormType.SUBMIT("Login"),
]
return form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment