Commit cc428fbf authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'feature/photos-api-filters' into 'master'

Add search filter to photos api

See merge request !795
parents 2c452863 a218b28e
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,
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