def index_from_year(request, year): """ Shows the posts from the year specified in the year parameter. """ posts = Post.published_posts_by_year(year) # Render paginated page return paginated_news_index(request, posts)
def test_filter_on_date_range_works_as_expected(self): posts = Post.published_posts_by_year(2016) self.assertEqual(len(posts), 2)