Here we provide a web form to create a new appointment as shown in the following screenshot:
We will continue to work from the
app.py file from
sched and the
viewfunction to do both GET and POST handling for the form. Here, we pull together
db.sessionfrom the database section and
AppointmentFormfrom the forms section. In
from flask import abort, jsonify, redirect, render_template from flask import request, url_for from sched.forms import AppointmentForm from sched.models import Appointment # ... skipping ahead. Keep previous code from app.py ...