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 committed by Alexandre Iooss
parent df2e376f89
commit ee13404157
2 changed files with 7 additions and 1 deletions

View file

@ -749,7 +749,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')
# LOCAL EMAILS

View file

@ -201,6 +201,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