8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 01:13:46 +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 b22b6fc90c
commit 133d83f282

View file

@ -19,13 +19,17 @@ class InterfaceSerializer(serializers.ModelSerializer):
mac_address = serializers.SerializerMethodField('get_macaddress') mac_address = serializers.SerializerMethodField('get_macaddress')
dns = serializers.SerializerMethodField('get_dns') dns = serializers.SerializerMethodField('get_dns')
domain = serializers.SerializerMethodField('get_dns') domain = serializers.SerializerMethodField('get_dns')
extension = serializers.SerializerMethodField('get_extension')
class Meta: class Meta:
model = Interface model = Interface
fields = ('ipv4', 'mac_address', 'domain') fields = ('ipv4', 'mac_address', 'domain', 'extension')
def get_dns(self, obj): def get_dns(self, obj):
return obj return obj.domain.name
def get_extension(self, obj):
return obj.domain.extension.name
def get_macaddress(self, obj): def get_macaddress(self, obj):
return str(obj.mac_address) return str(obj.mac_address)