Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
a218b28e
Verified
Commit
a218b28e
authored
May 16, 2018
by
Sébastiaan Versteeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add filters to the photo API
parent
735514e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
website/photos/api/viewsets.py
website/photos/api/viewsets.py
+3
-1
No files found.
website/photos/api/viewsets.py
View file @
a218b28e
from
rest_framework
import
permissions
from
rest_framework
import
permissions
,
filters
from
rest_framework.exceptions
import
PermissionDenied
from
rest_framework.mixins
import
CreateModelMixin
,
\
UpdateModelMixin
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment