def home(request): """The home page.""" if request.MOBILE: return redirect_to(request, 'products', permanent=False) return render(request, 'landings/home.html', {'products': Product.objects.filter(visible=True)})
def home(request): """The home page.""" if request.MOBILE: return redirect_to(request, 'products', permanent=False) return render(request, 'landings/home.html', { 'products': Product.objects.filter(visible=True) })
def home(request): """The home page.""" if request.MOBILE: return redirect_to(request, 'products', permanent=False) products = Product.objects.filter(visible=True) moz_news = get_object_fallback( Document, MOZILLA_NEWS_DOC, request.LANGUAGE_CODE) return render(request, 'landings/home.html', { 'products': products, 'moz_news': moz_news})
def home(request): """The home page.""" if request.MOBILE: return redirect_to(request, 'products', permanent=False) products = Product.objects.filter(visible=True) moz_news = get_object_fallback(Document, MOZILLA_NEWS_DOC, request.LANGUAGE_CODE) return render(request, 'landings/home.html', { 'products': products, 'moz_news': moz_news })
def desktop_or_mobile(request): """Redirect mobile browsers to /mobile and others to /home.""" mobile = 'products' url_name = mobile if request.MOBILE else 'home' return redirect_to(request, url_name, permanent=False)
def test_redirect_kwargs(self): resp = redirect_to(self.rf.get('/'), url='users.confirm_email', activation_key='1234') eq_(reverse('users.confirm_email', args=['1234']), resp['location'])
def test_redirect_permanent(self): resp = redirect_to(self.rf.get('/'), url='home') assert isinstance(resp, HttpResponsePermanentRedirect) eq_(reverse('home'), resp['location'])
def test_redirect_permanent(self): resp = redirect_to(self.rf.get("/"), url="home") assert isinstance(resp, HttpResponsePermanentRedirect) eq_(reverse("home"), resp["location"])