mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-25 16:33:47 +00:00
Résumé des machines
This commit is contained in:
parent
e4598785ff
commit
9465ea5d21
2 changed files with 13 additions and 1 deletions
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue