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

Complete_name d'un switch

This commit is contained in:
Gabriel Detraz 2018-07-09 21:06:21 +02:00
parent d1131d732f
commit a5726603e3
2 changed files with 7 additions and 1 deletions

View file

@ -723,7 +723,7 @@ class SwitchPortSerializer(serializers.ModelSerializer):
class Meta:
model = topologie.Switch
fields = ('short_name', 'model', 'switchbay', 'ports', 'ipv4', 'ipv6', 'subnet', 'subnet6')
fields = ('short_name', 'complete_name', 'model', 'switchbay', 'ports', 'ipv4', 'ipv6', 'subnet', 'subnet6')
# DHCP

View file

@ -197,6 +197,12 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
de cette machine"""
return str(self.interface_set.first().domain.name)
@cached_property
def complete_name(self):
"""Par defaut, renvoie le nom de la première interface
de cette machine"""
return str(self.interface_set.first())
@cached_property
def all_short_names(self):
"""Renvoie de manière unique, le nom des interfaces de cette