Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Add Notification sorting support
Browse files Browse the repository at this point in the history
  • Loading branch information
mparent61 committed Jul 27, 2016
1 parent f60dc72 commit 7d26665
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@
## Version 3.8.1

- Added `ImageFieldSerializer` for `Notification.image`
- Added `Notification` endpoint sorting support

## Version 3.8.0

Expand Down
7 changes: 6 additions & 1 deletion bulbs/notifications/viewsets.py
Expand Up @@ -9,9 +9,14 @@ class NotificationViewSet(viewsets.ModelViewSet):

queryset = Notification.objects.all().order_by('-created_on')
serializer_class = NotificationSerializer
filter_backends = (filters.DjangoFilterBackend, filters.SearchFilter)
filter_backends = (filters.DjangoFilterBackend,
filters.OrderingFilter,
filters.SearchFilter)
filter_fields = ('is_published',)
search_fields = ('internal_title',)
ordering_fields = ('internal_title',
'is_published',
'created_on')
paginate_by = 20
permission_classes = [IsAdminUser]

Expand Down

0 comments on commit 7d26665

Please sign in to comment.