8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-16 00:13:12 +00:00

Remplace trnoname par de meilleurs affichages

This commit is contained in:
detraz 2018-10-15 00:58:46 +02:00
parent 3b11d351a7
commit c15c01448a
2 changed files with 6 additions and 1 deletions

View file

@ -213,6 +213,11 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
interface_parent__machine=self interface_parent__machine=self
).values_list('name', flat=True).distinct() ).values_list('name', flat=True).distinct()
@cached_property
def get_name(self):
"""Return a name : user provided name or first interface name"""
return self.name or self.short_name
@cached_property @cached_property
def all_complete_names(self): def all_complete_names(self):
"""Renvoie tous les tls complets de la machine""" """Renvoie tous les tls complets de la machine"""

View file

@ -52,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td colspan="4"> <td colspan="4">
{% trans "No name" as tr_no_name %} {% trans "No name" as tr_no_name %}
{% trans "View the profile" as tr_view_the_profile %} {% trans "View the profile" as tr_view_the_profile %}
<b>{{ machine.name|default:'<i>tr_no_name</i>' }}</b> <i class="fa fa-angle-right"></i> <b>{{ machine.get_name|default:'<i>tr_no_name</i>' }}</b> <i class="fa fa-angle-right"></i>
<a href="{% url 'users:profil' userid=machine.user.id %}" title=tr_view_the_profile> <a href="{% url 'users:profil' userid=machine.user.id %}" title=tr_view_the_profile>
<i class="fa fa-user"></i> {{ machine.user }} <i class="fa fa-user"></i> {{ machine.user }}
</a> </a>