def sidebar(): """ Fetch a dict of information that should be used for each view e.g. recent posts, posts by view used in base_blog.html """ recent_posts = Post.query_all().limit(5) grouped_by_month = Post.group_by_year_month() return recent_posts, grouped_by_month
def sidebar(): """ Fetch a dict of information that should be used for each view e.g. recent posts, posts by view used in base_blog.html """ recent_posts = Post.query_all().limit(5) grouped_by_month = Post.group_by_year_month() return recent_posts, grouped_by_month
def index(page=1): """ Display the main page of the blog with the most recent blog posts paginated and displayed :param int page: Which paginated page of blog entries to display """ posts = Post.query_all().paginate(page, POSTS_PER_PAGE, False) pagination = Pagination(page=page, total=posts.total, per_page=POSTS_PER_PAGE, record_name='posts', bs_version=3) recent, group_month = sidebar() return render_template('kevcrablog/index.html', posts=posts, pagination=pagination, recent_posts=recent, grouped_by_month=group_month, title='Blog')
def index(page=1): """ Display the main page of the blog with the most recent blog posts paginated and displayed :param int page: Which paginated page of blog entries to display """ posts = Post.query_all().paginate(page, POSTS_PER_PAGE, False) pagination = Pagination(page=page, total=posts.total, per_page=POSTS_PER_PAGE, record_name='posts', bs_version=3) recent, group_month = sidebar() return render_template('kevcrablog/index.html', posts=posts, pagination=pagination, recent_posts=recent, grouped_by_month=group_month, title='Blog')
def index(): """ Main site index page """ frontpage_posts = Post.query_all().slice(0, 3) return render_template('index.html', frontpage_posts=frontpage_posts)
def index(): """ Main site index page """ frontpage_posts = Post.query_all().slice(0, 3) return render_template('index.html', frontpage_posts=frontpage_posts)