def article_detail(self, request, slug, template="article/article_detail.html"): articles = self.article_service.get_published_articles_with_related_articles(request) article = process_tag_or_categories_or_article(slug, articles) page = get_page(request) article_map = get_article_map(True) if article_is_a_perspective(article): request.path_info = '/policy-edits/' page = get_page(request) return render(request, template, {"article": article, "page": page, 'form': MapFormForSideBar(initial={'map': article_map}), "latest_commented_articles": self.article_service.get_latest_unique_commented_on_articles()})
def promoted_article_on_homepage(self, request, template="pages/index.html"): settings.use_editable() about_page = self.about_us_page(request) if (about_page): about_page_description = about_page.description else: about_page_description = None if request.is_ajax(): template = "includes/articles.html" return render(request, template, self.get_context_for_promoted_articles(article_service.get_promoted_articles(), article_service.get_carousel_content(), article_service.get_latest_articles(), get_page(request), about_page_description))
def perspectives_list(self, request, template="article/article_list.html"): category = article_service.get_perspectives_category() page_template = "article/article_list_page.html" if category: category = reduce(get_title, category) category.category_long_description = None articles = article_service.get_all_articles_in_category(category) if request.is_ajax(): template = page_template return render(request, template, article_list.get_context_for_article_list( articles, category=category, page=get_page(request)), context_instance=RequestContext(request)) else: return render(request, template, article_list.get_context_for_article_list(None, category=None, page=get_page(request)), context_instance=RequestContext(request))
def article_list_by_date(self, request, tag=None, category=None, template="article/article_list_by_date.html"): settings.use_editable() page_template = "article/article_list_by_date_page.html" articles = article_service.get_all_published_and_category_assigned_articles_without_carousel_items_and_perspectives( request ) request.path_info = "/article/" if request.is_ajax(): template = page_template return render( request, template, self.get_context_for_article_list(articles, get_page(request)), context_instance=RequestContext(request), )
def article_list(self, request, tag=None, category=None, template="article/article_list.html"): settings.use_editable() page_template = "article/article_list_page.html" articles = article_service.get_all_published_and_category_assigned_articles_without_carousel_items_and_perspectives( request ) if tag is not None: tag = process_tag_or_categories_or_article(tag, Keyword) articles = self.get_articles_for_given_tag(tag) articles = translate_to_model(articles) if category is not None: category = process_tag_or_categories_or_article(category, ArticleCategory) articles = self.get_articles_for_given_category(category) author = None if request.is_ajax(): template = page_template return render( request, template, self.get_context_for_article_list(articles, author, category, tag, get_page(request)), context_instance=RequestContext(request), )
def about_us_page(self, request): dummy_request = copy(request) dummy_request.path_info = "/about/" about_page = get_page(dummy_request) return about_page
def category_list_with_two_articles(self, request, template="pages/categories_page.html"): settings.use_editable() return render(request, template, self.get_context_for_category_list( article_service.get_all_article_categories_with_their_articles(), get_page(request)))