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

affichage des ports plus naturel

This commit is contained in:
grisel-davy 2018-04-02 20:12:53 +02:00
parent f39ae95b35
commit cf9d37dc54
3 changed files with 87 additions and 30 deletions

View file

@ -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>

View file

@ -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 />

View file

@ -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.