mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-26 08:53:46 +00:00
Serializer django 1.10
This commit is contained in:
parent
e6b6467ae2
commit
6b846ad0d4
1 changed files with 5 additions and 1 deletions
|
@ -16,11 +16,15 @@ class IpListSerializer(serializers.ModelSerializer):
|
|||
|
||||
class InterfaceSerializer(serializers.ModelSerializer):
|
||||
ipv4 = IpListSerializer(read_only=True)
|
||||
mac_address = serializers.SerializerMethodField('get_macaddress')
|
||||
|
||||
class Meta:
|
||||
model = Interface
|
||||
fields = ('ipv4', 'mac_address', 'dns')
|
||||
|
||||
def get_macaddress(self, obj):
|
||||
return str(obj.mac_address)
|
||||
|
||||
class ExtensionNameField(serializers.RelatedField):
|
||||
def to_representation(self, value):
|
||||
return value.name
|
||||
|
|
Loading…
Reference in a new issue