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 FlaskFormfrom wtforms import TextField, FloatFieldclass 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

Get Mastering Geospatial Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.