Verified Commit a218b28e authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Add filters to the photo API

parent 735514e6
from rest_framework import permissions
from rest_framework import permissions, filters
from rest_framework.exceptions import PermissionDenied
from rest_framework.mixins import CreateModelMixin, \
......@@ -12,6 +12,8 @@ from photos.models import Album, Photo
class AlbumsViewSet(ModelViewSet):
permission_classes = (permissions.IsAuthenticated,)
queryset = Album.objects.all()
filter_backends = (filters.SearchFilter,)
search_fields = ('title_en', 'title_nl', 'date', 'slug')
def get_queryset(self):
return services.get_annotated_accessible_albums(self.request,
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