Flask Web Development by Miguel Grinberg

Flask Web Development by Miguel Grinberg

Author:Miguel Grinberg
Language: eng
Format: epub, mobi, pdf
ISBN: 9781449372620
Publisher: O'Reilly Media
Published: 2014-08-20T04:00:00+00:00


This template has a few interesting implementation details:

The name and location fields are rendered inside a single <p> element. Only when at least one of the fields is defined is the <p> element created.

The user location field is rendered as a link to a Google Maps query.

If the logged-in user is an administrator, then email addresses are shown, rendered as a mailto link.

As most users will want easy access to their own profile page, a link to it can be added to the navigation bar. The relevant changes to the base.html template are shown in Example 10-6.

Example 10-6. app/templates/base.html

{% if current_user.is_authenticated() %} <li> <a href="{{ url_for('main.user', username=current_user.username) }}"> Profile </a> </li> {% endif %}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.