From cf9d37dc541018195e61e573d2e3f50f08e8b60e Mon Sep 17 00:00:00 2001 From: grisel-davy Date: Mon, 2 Apr 2018 20:12:53 +0200 Subject: [PATCH] affichage des ports plus naturel --- topologie/templates/topologie/aff_port.html | 59 +++++++++++++++++++++ topologie/templates/topologie/index_p.html | 3 +- users/models.py | 55 +++++++++---------- 3 files changed, 87 insertions(+), 30 deletions(-) diff --git a/topologie/templates/topologie/aff_port.html b/topologie/templates/topologie/aff_port.html index 1eef75b8..8a1268a3 100644 --- a/topologie/templates/topologie/aff_port.html +++ b/topologie/templates/topologie/aff_port.html @@ -24,6 +24,64 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load acl %} + +
+ + + + + {% for port in port_list|slice:"::2" %} + + {% endfor %} + + + + + {% for port in port_list|slice:"::2" %} + + {% endfor %} + + + + + + {% for port in port_list|slice:"1::2" %} + + {% endfor %} + + + + + {% for port in port_list|slice:"1::2" %} + + {% endfor %} + + +
{{ port.port }}
+ {% if port.room %} + {{ port.room }} + {% elif port.machine_interface %} + {{ port.machine_interface }} + {% elif port.related%} + {{ port.related }} + {% else %} + Vide + {% endif %} +
{{ port.port }}
+ {% if port.room %} + {{ port.room }} + {% elif port.machine_interface %} + {{ port.machine_interface }} + {% elif port.related%} + {{ port.related }} + {% else %} + Vide + {% endif %} +
+
+ + +
@@ -76,3 +134,4 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endfor %}
+
diff --git a/topologie/templates/topologie/index_p.html b/topologie/templates/topologie/index_p.html index 4fc1a61d..0bd62039 100644 --- a/topologie/templates/topologie/index_p.html +++ b/topologie/templates/topologie/index_p.html @@ -35,7 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc., Ajouter un port Ajouter des ports {% acl_end %} - {% include "topologie/aff_port.html" with port_list=port_list %} +
+{% include "topologie/aff_port.html" with port_list=port_list %}


diff --git a/users/models.py b/users/models.py index caa03ce3..8b4b11c9 100644 --- a/users/models.py +++ b/users/models.py @@ -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.