From 02130df21fa2d68d845fdb412c4a8ed43ca0237b Mon Sep 17 00:00:00 2001 From: Patrick Mayr Date: Tue, 29 Nov 2022 12:48:51 +0000 Subject: [PATCH] search only for authenticated users --- fet2020/search/views.py | 2 ++ fet2020/templates/base.html | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/fet2020/search/views.py b/fet2020/search/views.py index de5c67fd..546f76d4 100644 --- a/fet2020/search/views.py +++ b/fet2020/search/views.py @@ -4,6 +4,7 @@ from haystack.query import SearchQuerySet from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render +from authentications.decorators import authenticated_user from .forms import FetUserSearchForm, NonUserSearchForm @@ -19,6 +20,7 @@ class NonUserSearchView(SearchView): form_class = NonUserSearchForm +@authenticated_user def index(request): if request.user.is_authenticated: return FetUserSearchView.as_view()(request) diff --git a/fet2020/templates/base.html b/fet2020/templates/base.html index 78c4e825..f2814f2d 100644 --- a/fet2020/templates/base.html +++ b/fet2020/templates/base.html @@ -5,6 +5,7 @@ {% block body %} + {% if request.user.is_authenticated %}
+ {% endif %} {% if not request.user.is_authenticated %}