forms.py

To capture data from the user, such as a new arena, a form will be used. Create a file called forms.py inside the application folder, and add the following code:

from flask_wtf import FlaskForm
from wtforms import TextField, FloatField
class AddForm(FlaskForm):
name = TextField('Arena Name')
longitude = FloatField('Longitude')
latitude = FloatField('Latitude')

This code will add the fields to a template, which will be discussed in the section on using POST methods. It will allow for code to be entered from an HTML template and passed to the server to add a new arena

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset