Added a Form subclass for Post submissions.
Modified the index template.
Added the PostForm to the index template similar to forms added earlier.
Modified the view function for /index.
Added a PostForm object which will be added to the DB session.
This PostForm object is also put in the call to render_template.
Minor imports missing from app/views.py.
Protip: The redirect(url_for('index')) at the end of the if-block which adds the new post into the database has a very good reason of being there.
If absent, when the user refresher the browser an identical POST request with the same data will be sent to the DB. However, if present, it forces the browser to issue a GET request.
Now, if the user attempts a refresh, it will redo the GET request instead.
Changed the posts var in the index view function to get all followed posts.
User.followed_posts() returns an sqlalchemy query object that grabs posts that we are interested in seeing.
all() then returns all the posts in list form.
Added POSTS_PER_PAGE for pagination.
Modified the index view function.
Added a route decorator for URLS of the type /index/1, /index/2 and so on, depicting pages.
The paginate() method returns a Pagination object, whose items attribute has the necessary items, which here is three posts per page.
Modified the index view function and the index template.
Keeping the whole Pagination object instead of its items attribute.
Modified the index template to acquire the items attribute instead.
Modified the index template again.
Added Newer Posts and Older Posts links.
The Newer Posts link takes us to the previous page (newer posts appear first and older posts appear on later pages) and Older Posts does the opposite.
Included the post template in the index template.
Modified the user view function.
This is to bring pagination to the user profile page.
Made the corresponding change to the user template.
Minor mistake in <a> tag in index template.
Added the User class import to app/forms.py.
Added a sorted_posts() method to the User model class.
Merge pull request #7 from VaticanCameos/ch9

Adding chapter 9