Commit e15d7152 authored by Volkov Gherman's avatar Volkov Gherman

Дозаввершил проект курсовой работы News

parent 98151318
No preview for this file type
......@@ -17,9 +17,10 @@ class PostListView(ListView):
paginate_by = 10
def get_queryset(self):
if self.request.user.is_superuser:
if not self.request.user.is_superuser:
queryset = super().get_queryset().filter(is_active=True)
return queryset
else:
return super().get_queryset()
......@@ -125,9 +126,6 @@ class SearchView(ListView):
query = Q(title__icontains=self.search_value) | Q(text__icontains=self.search_value)
query_set = query_set.filter(query)
return query_set
else:
return query_set
def get_search_form(self):
return SearchForm(self.request.GET)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment