Commit ae677965 authored by Thom Wiggers's avatar Thom Wiggers 📐 Committed by Sébastiaan Versteeg
Browse files

Merge branch 'fix/566-photos-unavailable' into 'master'

Fix availability of photo albums on the website

Closes #566

See merge request !714

(cherry picked from commit fbdc5dea)

6b9e2f32 Fix availability of photo albums on the website
parent 9f2e42cb
......@@ -14,8 +14,8 @@ class AlbumsViewSet(ModelViewSet):
queryset = Album.objects.all()
def get_queryset(self):
return services.annotate_accessible_albums(self.request,
return services.get_annotated_accessible_albums(self.request,
def create(self, request, *args, **kwargs):
if self.request.user.has_perm('photos.create_album'):
......@@ -18,7 +18,7 @@ def is_album_accessible(request, album):
# Annotate the albums which are accessible by the user
def annotate_accessible_albums(request, albums):
def get_annotated_accessible_albums(request, albums):
if request.member and request.member.current_membership is None:
# The user is currently not a member
# so only show photos that were made during their membership
......@@ -49,4 +49,4 @@ def can_view_album(request, album):
filter = Q( & (Q( |
return request.member.membership_set.filter(filter).count() > 0
return False
return True
......@@ -22,7 +22,7 @@ def index(request):
# Only show published albums
albums = Album.objects.filter(hidden=False)
services.annotate_accessible_albums(request, albums)
albums = services.get_annotated_accessible_albums(request, albums)
albums = albums.order_by('-date')
paginator = Paginator(albums, 12)
Supports Markdown
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