def get_context_data(self, **kwargs): # Featured Shelf category_choice_form = CategoryChoiceForm(self.request, cookie="featured_by_category") initial_category_slug = category_choice_form.fields["category"].initial featured_title_list = get_featured_shelf_titles(initial_category_slug) # Top Rated Shelf category_choice_form_popular = CategoryChoiceForm(self.request, cookie="popular_by_category") initial_category_slug_popular = category_choice_form_popular.fields["category"].initial toprated_title_list = get_popular_shelf_titles(initial_category_slug_popular) # Recently Released Shelf category_choice_form_recent = CategoryChoiceForm(self.request, cookie="recent_by_category") initial_category_slug_recent = category_choice_form_recent.fields["category"].initial recently_released_list = get_recently_released_shelf_titles(initial_category_slug_recent) # Render Template response_data = { 'featured_title_list': featured_title_list, 'toprated_title_list': toprated_title_list, 'recently_released_list': recently_released_list, 'category_choice_form': category_choice_form, 'contributor_choice_form': category_choice_form_popular, 'category_choice_form_recent': category_choice_form_recent, } return response_data
def get_context_data(self, **kwargs): # Featured Shelf category_choice_form = CategoryChoiceForm( self.request, cookie="featured_by_category") initial_category_slug = category_choice_form.fields["category"].initial featured_title_list = get_featured_shelf_titles(initial_category_slug) # Top Rated Shelf category_choice_form_popular = CategoryChoiceForm( self.request, cookie="popular_by_category") initial_category_slug_popular = category_choice_form_popular.fields[ "category"].initial toprated_title_list = get_popular_shelf_titles( initial_category_slug_popular) # Recently Released Shelf category_choice_form_recent = CategoryChoiceForm( self.request, cookie="recent_by_category") initial_category_slug_recent = category_choice_form_recent.fields[ "category"].initial recently_released_list = get_recently_released_shelf_titles( initial_category_slug_recent) # Render Template response_data = { 'featured_title_list': featured_title_list, 'toprated_title_list': toprated_title_list, 'recently_released_list': recently_released_list, 'category_choice_form': category_choice_form, 'contributor_choice_form': category_choice_form_popular, 'category_choice_form_recent': category_choice_form_recent, } return response_data
def recent_by_category(self, category='all'): """ Display Recently Released Titles by Category """ recently_released_list = get_recently_released_shelf_titles(category) return render_to_response("core/shelf/tags/show_shelf_pages.html", {"title_list": recently_released_list, "no_ads": True})