From c5f96fee62061cde6008351fb9c20ef02df92821 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 8 Oct 2019 18:27:09 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Fix=20:=20autorise=20blank=20pour=20message?= =?UTF-8?q?=20mail=20adh=C3=A9sion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0064_auto_20191008_1335.py | 25 +++++++++++++++++++ preferences/models.py | 12 +++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 preferences/migrations/0064_auto_20191008_1335.py diff --git a/preferences/migrations/0064_auto_20191008_1335.py b/preferences/migrations/0064_auto_20191008_1335.py new file mode 100644 index 00000000..a1bdb9fc --- /dev/null +++ b/preferences/migrations/0064_auto_20191008_1335.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.23 on 2019-10-08 11:35 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0063_mandate'), + ] + + operations = [ + migrations.AlterField( + model_name='mailmessageoption', + name='welcome_mail_en', + field=models.TextField(blank=True, default='', help_text='Welcome email in English'), + ), + migrations.AlterField( + model_name='mailmessageoption', + name='welcome_mail_fr', + field=models.TextField(blank=True, default='', help_text='Welcome email in French'), + ), + ] diff --git a/preferences/models.py b/preferences/models.py index f09e63a7..c0bd1f89 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -616,8 +616,16 @@ def homeoption_post_save(**kwargs): class MailMessageOption(AclMixin, models.Model): """Reglages, mail de bienvenue et autre""" - welcome_mail_fr = models.TextField(default="", help_text=_("Welcome email in French")) - welcome_mail_en = models.TextField(default="", help_text=_("Welcome email in English")) + welcome_mail_fr = models.TextField( + default="", + blank=True, + help_text=_("Welcome email in French") + ) + welcome_mail_en = models.TextField( + default="", + blank=True, + help_text=_("Welcome email in English") + ) class Meta: permissions = ( From 144119c26adbdcbcd9d03db59bd6ddfa2113bfc7 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Thu, 10 Oct 2019 15:43:01 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Fix=20:=20possibilit=C3=A9=20de=20mettre=20?= =?UTF-8?q?plusieurs=20clefs=20radius=20sans=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0065_auto_20191010_1227.py | 20 +++++++++++++++++++ preferences/models.py | 10 ++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 preferences/migrations/0065_auto_20191010_1227.py diff --git a/preferences/migrations/0065_auto_20191010_1227.py b/preferences/migrations/0065_auto_20191010_1227.py new file mode 100644 index 00000000..175dfd5b --- /dev/null +++ b/preferences/migrations/0065_auto_20191010_1227.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.23 on 2019-10-10 10:27 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0064_auto_20191008_1335'), + ] + + operations = [ + migrations.AlterField( + model_name='radiuskey', + name='default_switch', + field=models.BooleanField(default=False, help_text='Default key for switches'), + ), + ] diff --git a/preferences/models.py b/preferences/models.py index c0bd1f89..f3c8fd7b 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -330,8 +330,7 @@ class RadiusKey(AclMixin, models.Model): help_text=_("Comment for this key") ) default_switch = models.BooleanField( - default=True, - unique=True, + default=False, help_text=_("Default key for switches") ) @@ -342,6 +341,13 @@ class RadiusKey(AclMixin, models.Model): verbose_name = _("RADIUS key") verbose_name_plural = _("RADIUS keys") + def clean(self): + """Clean model: + Check default switch is unique + """ + if RadiusKey.objects.filter(default_switch=True).count() > 1: + raise ValidationError(_("Default radiuskey for switchs already exist")) + def __str__(self): return _("RADIUS key ") + str(self.id) + " " + str(self.comment) From 58c120410a5f0c89f57d9c4c9455fa49a3d85834 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Thu, 10 Oct 2019 15:43:52 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Fix=20:=20affichage=20des=20tickets,=20?= =?UTF-8?q?=C3=A9vite=20un=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tickets/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tickets/views.py b/tickets/views.py index b16e4eea..e59c69a0 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -186,7 +186,7 @@ def preferences(request): def contact(request): """View to display a contact address on the contact page used here to display a link to open a ticket""" - return ('users', render_to_string('tickets/contact.html')) + return render_to_string('tickets/contact.html') def navbar_user(): """View to display the ticket link in thet user's dropdown in the navbar"""