from flask_wtf import Form
from flask_wtf.csrf import CsrfProtect
from wtforms import StringField, IntegerField, SelectField, BooleanField

csrf = CsrfProtect()


class Submission(Form):
    submission = StringField('Submission URL')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])


class Subreddit(Form):
    subreddit = StringField('Subreddit')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    time = SelectField('Time period',
                       choices=[('all', 'all'), ('year', 'year'), ('month', 'month'), ('week', 'week'), ('day', 'day'),
                                ('hour', 'hour')], default='week')
    limit = IntegerField('Number of posts')
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])

from flask_wtf import FlaskForm
from flask_wtf.csrf import CsrfProtect
from wtforms import StringField, IntegerField, SelectField, BooleanField

csrf = CsrfProtect()


class Submission(FlaskForm):
    submission = StringField('Submission URL')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])


class Subreddit(FlaskForm):
    subreddit = StringField('Subreddit')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    time = SelectField('Time period',
                       choices=[('all', 'all'), ('year', 'year'), ('month', 'month'), ('week', 'week'), ('day', 'day'),
                                ('hour', 'hour')], default='week')
    limit = IntegerField('Number of posts')
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])

Migrate from Form to FlaskForm
Migrate from Form to FlaskForm

- from flask_wtf import Form
+ from flask_wtf import FlaskForm
  from flask_wtf.csrf import CsrfProtect
  from wtforms import StringField, IntegerField, SelectField, BooleanField
  
  csrf = CsrfProtect()
  
  
- class Submission(Form):
+ class Submission(FlaskForm):
      submission = StringField('Submission URL')
      comments = BooleanField('Include comments')
      comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
      email = StringField('Kindle email address')
      kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])
  
  
- class Subreddit(Form):
+ class Subreddit(FlaskForm):
      subreddit = StringField('Subreddit')
      comments = BooleanField('Include comments')
      comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
      time = SelectField('Time period',
                         choices=[('all', 'all'), ('year', 'year'), ('month', 'month'), ('week', 'week'), ('day', 'day'),
                                  ('hour', 'hour')], default='week')
      limit = IntegerField('Number of posts')
      email = StringField('Kindle email address')
      kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])
  
Migrate from Form to FlaskForm
## Code Before:
from flask_wtf import Form
from flask_wtf.csrf import CsrfProtect
from wtforms import StringField, IntegerField, SelectField, BooleanField

csrf = CsrfProtect()


class Submission(Form):
    submission = StringField('Submission URL')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])


class Subreddit(Form):
    subreddit = StringField('Subreddit')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    time = SelectField('Time period',
                       choices=[('all', 'all'), ('year', 'year'), ('month', 'month'), ('week', 'week'), ('day', 'day'),
                                ('hour', 'hour')], default='week')
    limit = IntegerField('Number of posts')
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])

## Instruction:
Migrate from Form to FlaskForm
## Code After:
from flask_wtf import FlaskForm
from flask_wtf.csrf import CsrfProtect
from wtforms import StringField, IntegerField, SelectField, BooleanField

csrf = CsrfProtect()


class Submission(FlaskForm):
    submission = StringField('Submission URL')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])


class Subreddit(FlaskForm):
    subreddit = StringField('Subreddit')
    comments = BooleanField('Include comments')
    comments_style = SelectField('Comments style', choices=[('numbers', 'numbers'), ('quotes', 'quotes')])
    time = SelectField('Time period',
                       choices=[('all', 'all'), ('year', 'year'), ('month', 'month'), ('week', 'week'), ('day', 'day'),
                                ('hour', 'hour')], default='week')
    limit = IntegerField('Number of posts')
    email = StringField('Kindle email address')
    kindle_address = SelectField('Kindle address', choices=[('normal', '@kindle.com'), ('free', '@free.kindle.com')])
