Blame view

flashcards/views.py 737 Bytes
491577131   Andrew Buss   Class -> section....
1
2
3
4
  from flashcards.models import Section, LecturePeriod
  from flashcards.serializers import SectionSerializer, LecturePeriodSerializer
  from rest_framework.permissions import IsAuthenticatedOrReadOnly
  from rest_framework.viewsets import ModelViewSet
a8489c38a   Andrew Buss   Set up flashy pro...
5

cb310dc9b   Rohan Rangray   Added pagination....
6
7
8
9
  REST_FRAMEWORK = {
          'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.CursorPagination',
          'PAGE_SIZE': 20
          }
491577131   Andrew Buss   Class -> section....
10
11
12
13
14
15
16
17
18
  
  class SectionViewSet(ModelViewSet):
      queryset = Section.objects.all()
      serializer_class = SectionSerializer
      permission_classes = (IsAuthenticatedOrReadOnly,)
  
  class LecturePeriodViewSet(ModelViewSet):
      queryset = LecturePeriod.objects.all()
      serializer_class = LecturePeriodSerializer
cb310dc9b   Rohan Rangray   Added pagination....
19
      permission_classes = (IsAuthenticatedOrReadOnly,)