Commit 1a61f7a1 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Serializer django 1.10

parent ca14749a
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment