8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +00:00

Merge branch 'fix_bugs_divers' into 'dev'

Fix bugs divers

See merge request federez/re2o!458
This commit is contained in:
klafyvel 2019-10-10 19:19:03 +02:00
commit e98f3b2286
4 changed files with 64 additions and 5 deletions

View file

@ -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'),
),
]

View file

@ -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'),
),
]

View file

@ -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)
@ -616,8 +622,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 = (

View file

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