Relationship query

If the county query was successful, the district query is performed, and then a relationship attribute (state_ref) is used to find the state within which the county is placed:

        state = county.state_ref

The two-way relationship established in the County, District, and State model definitions make this possible. This state object is a member of the State model class and can be used to retrieve the name of the state.

To create the custom popup, string template formatting is used to populate the popup with the specifics describing the arena requested. The result is assigned to the variable form.popup.

Finally, the populated form is then passed once again to the index.html template, but this time it contains data about the selected arena:

    return render_template('index.html',form=form)

Here is a screenshot of the application query results for The Oracle Arena:

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

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