Filter books for discover page for privacy

This commit is contained in:
Mouse Reeve 2021-01-03 15:44:07 -08:00
parent c0bd0736d3
commit b608e36946

View file

@ -4,7 +4,7 @@ import re
from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.postgres.search import TrigramSimilarity from django.contrib.postgres.search import TrigramSimilarity
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.db.models import Avg, F, Q, Max from django.db.models import Avg, Q, Max
from django.db.models.functions import Greatest from django.db.models.functions import Greatest
from django.http import HttpResponseNotFound, JsonResponse from django.http import HttpResponseNotFound, JsonResponse
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
@ -137,7 +137,8 @@ def discover_page(request):
''' tiled book activity page ''' ''' tiled book activity page '''
books = models.Edition.objects.filter( books = models.Edition.objects.filter(
review__published_date__isnull=False, review__published_date__isnull=False,
review__user__local=True review__user__local=True,
review__privacy__in=['public', 'unlisted'],
).exclude( ).exclude(
cover__exact='' cover__exact=''
).annotate( ).annotate(