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

Displaying a record (Intermediate)

With content going into the database, let's get it back out as shown in the following figure:

Displaying a record (Intermediate)

Getting ready

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

How to do it...

  1. We provide a simple query to get an appointment by database ID. In app.py:
    # Note the import statements from the previous section. @app.route('/appointments/<int:appointment_id>/') def appointment_detail(appointment_id): """Provide HTML page with a given appointment.""" # Query: get Appointment object by ID. appt = db.session.query(Appointment).get(appointment_id) if appt is None: # Abort with Not Found. ...

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