Commit 6099d601 authored by chirac's avatar chirac

Résumé des machines

parent 1f47756b
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,
}
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment