pagination & ordering & country code
This commit is contained in:
parent
e3d41ecd8d
commit
3e83bdff59
|
|
@ -9,11 +9,17 @@ from utils.views import BindObjectMixin
|
|||
class CollectionViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
|
||||
"""ViewSet for Collection model."""
|
||||
|
||||
pagination_class = None
|
||||
# pagination_class = None
|
||||
permission_classes = (permissions.AllowAny,)
|
||||
queryset = models.Collection.objects.all()
|
||||
serializer_class = serializers.CollectionBackOfficeSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
"""Overridden method 'get_queryset'."""
|
||||
qs = models.Collection.objects.all().order_by('-created')
|
||||
if self.request.country_code:
|
||||
qs = qs.by_country_code(self.request.country_code)
|
||||
return qs
|
||||
|
||||
|
||||
class CollectionBackOfficeViewSet(mixins.CreateModelMixin,
|
||||
mixins.UpdateModelMixin,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user