55from flask_wtf import FlaskForm , CSRFProtect
66from wtforms .validators import DataRequired , Length , Regexp
77from wtforms .fields import *
8- from flask_bootstrap import Bootstrap4 , SwitchField
98from flask_sqlalchemy import SQLAlchemy
9+ from flask_bootstrap import Bootstrap4 , SwitchField
1010
1111app = Flask (__name__ )
1212app .secret_key = 'dev'
3434
3535class ExampleForm (FlaskForm ):
3636 """An example form that contains all the supported bootstrap style form fields."""
37+
3738 date = DateField (description = "We'll never share your email with anyone else." ) # add help text with `description`
3839 datetime = DateTimeField (render_kw = {'placeholder' : 'this is a placeholder' }) # add HTML attribute with `render_kw`
3940 datetime_local = DateTimeLocalField ()
@@ -52,8 +53,8 @@ class ExampleForm(FlaskForm):
5253 select = SelectField (choices = [('dog' , 'Dog' ), ('cat' , 'Cat' ), ('bird' , 'Bird' ), ('alien' , 'Alien' )])
5354 select_multiple = SelectMultipleField (choices = [('dog' , 'Dog' ), ('cat' , 'Cat' ), ('bird' , 'Bird' ), ('alien' , 'Alien' )])
5455 bio = TextAreaField ()
55- search = SearchField () # will autocapitalize on mobile
56- title = StringField () # will not autocapitalize on mobile
56+ search = SearchField () # will autocapitalize on mobile
57+ title = StringField () # will not autocapitalize on mobile
5758 secret = PasswordField ()
5859 remember = BooleanField ('Remember me' )
5960 submit = SubmitField ()
@@ -96,7 +97,8 @@ class ContactForm(FlaskForm):
9697
9798class BootswatchForm (FlaskForm ):
9899 """Form to test Bootswatch."""
99- #DO NOT EDIT! Use list-bootswatch.py to generate the Radiofield below.
100+
101+ # DO NOT EDIT! Use list-bootswatch.py to generate the Radiofield below.
100102 theme_name = RadioField (
101103 default = 'default' ,
102104 choices = [
@@ -208,7 +210,7 @@ def test_bootswatch():
208210 app .config ['BOOTSTRAP_BOOTSWATCH_THEME' ] = form .theme_name .data
209211 flash (f'Render style has been set to { form .theme_name .data } .' )
210212 else :
211- if app .config ['BOOTSTRAP_BOOTSWATCH_THEME' ] != None :
213+ if app .config ['BOOTSTRAP_BOOTSWATCH_THEME' ] is not None :
212214 form .theme_name .data = app .config ['BOOTSTRAP_BOOTSWATCH_THEME' ]
213215 return render_template ('bootswatch.html' , form = form )
214216
0 commit comments