Commit cf9d37dc authored by grisel-davy's avatar grisel-davy

affichage des ports plus naturel

parent f39ae95b
......@@ -24,6 +24,64 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
<div class="table-responsive" style="font-size: 12px">
<table class="table table-bordered text-center text-nowrap">
<thead>
<tr>
{% for port in port_list|slice:"::2" %}
<td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
</tr>
<tr>
{% for port in port_list|slice:"::2" %}
<td class="p-3 mb-2 bg-success text-dark">
{% if port.room %}
{{ port.room }}
{% elif port.machine_interface %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">{{ port.machine_interface }}</a>
{% elif port.related%}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">{{ port.related }}</a>
{% else %}
Vide
{% endif %}
</td>
{% endfor %}
</tr>
<tr>
{% for port in port_list|slice:"1::2" %}
<td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
</tr>
<tr>
{% for port in port_list|slice:"1::2" %}
<td class="p-3 mb-2 bg-success text-dark">
{% if port.room %}
{{ port.room }}
{% elif port.machine_interface %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">{{ port.machine_interface }}</a>
{% elif port.related%}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">{{ port.related }}</a>
{% else %}
Vide
{% endif %}
</td>
{% endfor %}
</tr>
</table>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
......@@ -76,3 +134,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr>
{% endfor %}
</table>
</div>
......@@ -35,7 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-port' id_switch %}"><i class="fa fa-plus"></i> Ajouter un port</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:create-ports' id_switch %}"><i class="fa fa-plus"></i> Ajouter des ports</a>
{% acl_end %}
{% include "topologie/aff_port.html" with port_list=port_list %}
<hr>
{% include "topologie/aff_port.html" with port_list=port_list %}
<br />
<br />
<br />
......
......@@ -548,15 +548,15 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, PermissionsMix
'welcome_mail_en': mailmessageoptions.welcome_mail_en,
'pseudo': self.pseudo,
})
send_mail(
'Bienvenue au %(name)s / Welcome to %(name)s' % {
'name': AssoOption.get_cached_value('name')
},
'',
GeneralOption.get_cached_value('email_from'),
[self.email],
html_message=template.render(context)
)
#send_mail(
# 'Bienvenue au %(name)s / Welcome to %(name)s' % {
# 'name': AssoOption.get_cached_value('name')
# },
# '',
# GeneralOption.get_cached_value('email_from'),
# [self.email],
# html_message=template.render(context)
#)
return
def reset_passwd_mail(self, request):
......@@ -576,14 +576,14 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, PermissionsMix
reverse('users:process', kwargs={'token': req.token})),
'expire_in': str(GeneralOption.get_cached_value('req_expire_hrs')) + ' heures',
}
send_mail(
'Changement de mot de passe du %(name)s / Password\
renewal for %(name)s' % {'name': AssoOption.get_cached_value('name')},
template.render(context),
GeneralOption.get_cached_value('email_from'),
[req.user.email],
fail_silently=False
)
#send_mail(
# 'Changement de mot de passe du %(name)s / Password\
# renewal for %(name)s' % {'name': AssoOption.get_cached_value('name')},
# template.render(context),
# GeneralOption.get_cached_value('email_from'),
# [req.user.email],
# fail_silently=False
#)
return
def autoregister_machine(self, mac_address, nas_type):
......@@ -892,8 +892,8 @@ def user_post_save(sender, **kwargs):
Synchronise le ldap"""
is_created = kwargs['created']
user = kwargs['instance']
if is_created:
user.notif_inscription()
#if is_created:
#user.notif_inscription()
user.ldap_sync(base=True, access_refresh=True, mac_refresh=False, group_refresh=True)
regen('mailing')
......@@ -1127,22 +1127,19 @@ class Ban(RevMixin, AclMixin, models.Model):
'date_end': self.date_end,
'asso_name': AssoOption.get_cached_value('name'),
})
send_mail(
'Deconnexion disciplinaire',
template.render(context),
GeneralOption.get_cached_value('email_from'),
[self.user.email],
fail_silently=False
)
#send_mail(
# 'Deconnexion disciplinaire',
# template.render(context),
# GeneralOption.get_cached_value('email_from'),
# [self.user.email],
# fail_silently=False
#)
return
def is_active(self):
"""Ce ban est-il actif?"""
return self.date_end > timezone.now()
def get_instance(banid, *args, **kwargs):
return Ban.objects.get(pk=banid)
def can_view(self, user_request, *args, **kwargs):
"""Check if an user can view a Ban object.
......
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