8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

fix mac-ip-dns

This commit is contained in:
Gabriel Detraz 2016-12-26 18:00:43 +01:00 committed by root
parent 0706021fa2
commit d6b488deac

View file

@ -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):