mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-03 12:47:51 +02:00
* Implement Rest API pagination * REST API must be enabled in settings * Report REST API status in the admin site settings page
22 lines
617 B
Python
22 lines
617 B
Python
from rest_framework.generics import ListAPIView, RetrieveAPIView
|
|
|
|
from ram.views import CustomLimitOffsetPagination
|
|
from consist.models import Consist
|
|
from consist.serializers import ConsistSerializer
|
|
|
|
|
|
class ConsistList(ListAPIView):
|
|
serializer_class = ConsistSerializer
|
|
pagination_class = CustomLimitOffsetPagination
|
|
|
|
def get_queryset(self):
|
|
return Consist.objects.get_published(self.request.user)
|
|
|
|
|
|
class ConsistGet(RetrieveAPIView):
|
|
serializer_class = ConsistSerializer
|
|
lookup_field = "uuid"
|
|
|
|
def get_queryset(self):
|
|
return Consist.objects.get_published(self.request.user)
|