def product_list(request): """The product picker page.""" if not show_ia(request): return old_products(request) products = Product.objects.filter(visible=True) return jingo.render(request, "products/products.html", {"products": products})
def product_landing(request, slug): """The product landing page.""" if not show_ia(request): return HttpResponseRedirect(reverse('products')) product = get_object_or_404(Product, slug=slug) return jingo.render(request, 'products/product.html', { 'product': product, 'topics': topics_for(products=[product])})
def home(request): """The home page.""" if not show_ia(request): return old_home(request) products = Product.objects.filter(visible=True) topics = Topic.objects.filter(visible=True) return jingo.render(request, 'landings/home.html', { 'products': products, 'topics': topics})
def document_listing(request, product_slug, topic_slug): """The document listing page for a product + topic.""" if not show_ia(request): return HttpResponseRedirect(reverse('products')) product = get_object_or_404(Product, slug=product_slug) topic = get_object_or_404(Topic, slug=topic_slug) documents = documents_for( locale=request.locale, products=[product], topics=[topic]) return jingo.render(request, 'products/documents.html', { 'product': product, 'topic': topic, 'documents': documents})
def topic_landing(request, slug): """The topic landing page. If `selectproduct=1` query param is passed, shows the product picker. Else, shows the list of articles. """ if not show_ia(request): # User should only be able to get here in new IA. # Redirect to home page return HttpResponseRedirect(reverse('home')) topic = get_object_or_404(Topic, slug=slug) data = dict(topic=topic) if request.GET.get('selectproduct') == '1': data.update(products=products_for(topics=[topic])) else: data.update(documents=documents_for( locale=request.locale, topics=[topic])) return jingo.render(request, 'topics/topic.html', data)