Added a view function for a user's profile page.
The app.route decorator here has an argument <nickname>, which gets its value from the function arg.
We try to load the user from the DB. If user is None, we redirect to the index page.
Else, we call render_template and send in some fake posts. The posts will be of one particular user, so 'author' is set correctly here.
Added a user template.
This template will be invoked on the render_template call in the new view function made in the last commit
Added a Your Profile link to the navigation bar in base template.
An argument has to be provided for the nickname, and this is obtained from global g.
Added an avatar method to the User class.
We use the Gravatar service to provide user avatars. The method returns the user's image scaled to the requested pixels.
An md5 hash of the email is created and incorporated into the URL. After that a number of options are available to customize the avatar.
'd=mm' determines the placeholder image incase the user has no Gravatar. mm refers to the mystery man image. 's=N' requests the avatar to scale to given size.
Modified the user template.
Added a table which contains the user's Gravatar and their nickname.
The User class is now responsible for returning avatars - this makes it easier for us to rewrite the avatar method to generate different URLs if Gravatar is not what we want.
Modified the user template to add sub-size avatars.
Each post now has sub-size avatars using the same logic as the main avatar.
Also fixed a small mistake in the template.
Separated the post template logically from the user template.
The post template is then included in the user template using Jinja2's include command.
Modified the database model.
The User class gets two new fields, about_me and last_seen.
Since the database model was modified, it was necessary to migrate the DB to a new version.
Changed the user template.
Added the last_seen and about_me fields. They are displayed only if they are set.
Modified the app/views.py file.
Added logic for the user's last_seen in the before_request handler.
Added a Form subclass for Profile Editing.
It has nickname and about_me as its fields.
Added an Edit template for profile editing.
It follows in the same vein as the previous templates.
Added a view function for profile edits.
Either the user enters data in the form and it is saved in Flask's g object, or the form gets its data from the g object.
Template rendering then occurs.
The user template is modified to include a link to profile edits.
The 'if user.id == g.user.id' conditional is used to make sure that a user will get to edit their own profile and not anyone else's.
Fixed indentation in app/views.py.
Fixed small spelling error in app/templates/user.html.
Merge pull request #4 from VaticanCameos/ch6

Adding chapter 6