O'Reilly logo

Instant Flask Web Development by Ron DuPlain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Listing all records (Simple)

We don't want users to keep track of the database IDs of their appointments, so we provide a view, which will list all the appointments that they have, as shown in the following screenshot:

Listing all records (Simple)

Getting ready

We will continue to work from the app.py file from the sched directory and the templates directory.

How to do it...

  1. We query for all appointments, in app.py:
    @app.route('/appointments/') def appointment_list(): """Provide HTML listing of all appointments.""" # Query: Get all Appointment objects, sorted by date. appts = (db.session.query(Appointment) .order_by(Appointment.start.asc()).all()) return render_template('appointment/index.html', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required