Last active
December 15, 2015 05:49
-
-
Save nubela/5211542 to your computer and use it in GitHub Desktop.
Generating HTML forms with built-in client-side and backend validators.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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