serializers.py 781 Bytes
Newer Older
1
2
3
4
5
# we don't need to deserialize, so we do not implement the abstract methods
# pylint: disable=abstract-method

from django.contrib.auth.models import Group
from rest_framework import serializers
Lukas Burgey's avatar
Lukas Burgey committed
6
from .models import SSHPublicKey, AuthGroup
7
8
9
10
11


class GroupSerializer(serializers.ModelSerializer):
    class Meta:
        model = Group
12
        fields = ['id', 'name']
13

Lukas Burgey's avatar
Lukas Burgey committed
14
15
16
17
18
19
20

class AuthGroupSerializer(serializers.ModelSerializer):
    class Meta:
        model = AuthGroup
        fields = ['id', 'name']


21
22
23
class SSHPublicKeySerializer(serializers.ModelSerializer):
    class Meta:
        model = SSHPublicKey
24
        fields = ['id', 'name', 'key']
Lukas Burgey's avatar
Lukas Burgey committed
25
26


Lukas Burgey's avatar
Lukas Burgey committed
27
class SSHPublicKeyRefSerializer(serializers.ModelSerializer):
Lukas Burgey's avatar
Lukas Burgey committed
28
29
30
    class Meta:
        model = SSHPublicKey
        fields = ['id', 'name']