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 serializers 

2from .models import PDU, Machine, Event 

3 

4 

5class MachineSerializer(serializers.HyperlinkedModelSerializer): 

6 url = serializers.HyperlinkedRelatedField(read_only=True, view_name='machine-detail', lookup_field='mac_address') 

7 

8 full_name = serializers.ReadOnlyField() 

9 

10 class Meta: 

11 model = Machine 

12 exclude = [] 

13 read_only_fields = ['first_seen', 'last_updated'] 

14 

15 

16class PDUSerializer(serializers.HyperlinkedModelSerializer): 

17 class Meta: 

18 model = PDU 

19 exclude = [] 

20 

21 

22class EventSerializer(serializers.ModelSerializer): 

23 machine = serializers.HyperlinkedRelatedField(read_only=True, 

24 view_name='machine-detail', 

25 lookup_field='mac_address') 

26 

27 class Meta: 

28 model = Event 

29 exclude = []