8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

Résumé des machines

This commit is contained in:
chirac 2016-07-10 18:29:40 +02:00
parent 1f47756bfb
commit 6099d60147
2 changed files with 13 additions and 1 deletions

View file

@ -1,7 +1,12 @@
from machines.models import Interface, Machine
def context_user(request):
user = request.user
if user.is_authenticated():
interfaces = Interface.objects.filter(machine=Machine.objects.filter(user=user, active=True))
else:
interfaces = None
is_cableur = user.has_perms(('cableur',))
is_bureau = user.has_perms(('bureau',))
is_bofh = user.has_perms(('bofh',))
@ -14,4 +19,5 @@ def context_user(request):
'is_bofh': is_bofh,
'is_trez': is_trez,
'is_infra': is_infra,
'interfaces': interfaces,
}

View file

@ -96,9 +96,15 @@
<p>Vous n'êtes pas authentifié</p>
{% endif %}
</div>
{% if request_user.is_authenticated %}
<div class="well">
<p>ADS</p>
{{ interfaces|length }} machines actives
{% for interface in interfaces|slice:":5" %}
<li>{{interface.dns}}</li>
{% endfor %}
<p><a href="{% url "users:mon-profil" %}">Voir toutes mes machines</a></p>
</div>
{% endif %}
</div>
</div>
</div>