Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from rest_framework import viewsets 

2from .models import PDU, Machine, Event 

3from .serializers import PDUSerializer, MachineSerializer, EventSerializer 

4from .forms import MachineFilter, EventFilter 

5 

6 

7class PDUViewSet(viewsets.ModelViewSet): 

8 queryset = PDU.objects.all() 

9 serializer_class = PDUSerializer 

10 

11 

12class MachineViewSet(viewsets.ModelViewSet): 

13 queryset = Machine.objects.all() 

14 serializer_class = MachineSerializer 

15 lookup_field = 'mac_address' 

16 filter_class = MachineFilter 

17 

18 

19class EventViewSet(viewsets.ReadOnlyModelViewSet): 

20 queryset = Event.objects.all() 

21 serializer_class = EventSerializer 

22 filter_class = EventFilter 

23 ordering_fields = ('date',) 

24 ordering = '-date'