Commit d6b488de authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

fix mac-ip-dns

parent 0706021f
......@@ -17,13 +17,17 @@ class IpListSerializer(serializers.ModelSerializer):
class InterfaceSerializer(serializers.ModelSerializer):
ipv4 = IpListSerializer(read_only=True)
domain = serializers.SerializerMethodField('get_dns')
extension = serializers.SerializerMethodField('get_extension')
class Meta:
model = Interface
fields = ('ipv4', 'mac_address', 'domain')
fields = ('ipv4', 'mac_address', 'domain', 'extension')
def get_dns(self, obj):
return obj
return obj.domain.name
def get_extension(self, obj):
return obj.domain.extension.name
class ExtensionNameField(serializers.RelatedField):
def to_representation(self, value):
......
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