Commit 77e62df3 authored by Laouen Fernet's avatar Laouen Fernet

add translations for preferences/

parent 62d09760
......@@ -359,7 +359,7 @@ class DelMailContactForm(Form):
"""Delete contact email adress"""
mailcontacts = forms.ModelMultipleChoiceField(
queryset=MailContact.objects.none(),
label="Enregistrements adresses actuels",
label=_("Current email addresses"),
widget=forms.CheckboxSelectMultiple
)
......
This diff is collapsed.
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2019-01-08 22:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import re2o.aes_field
class Migration(migrations.Migration):
dependencies = [
('preferences', '0057_optionaluser_all_users_active'),
]
operations = [
migrations.AlterModelOptions(
name='radiuskey',
options={'permissions': (('view_radiuskey', 'Can view a RADIUS key object'),), 'verbose_name': 'RADIUS key', 'verbose_name_plural': 'RADIUS keys'},
),
migrations.AlterModelOptions(
name='radiusoption',
options={'verbose_name': 'RADIUS policy', 'verbose_name_plural': 'RADIUS policies'},
),
migrations.AlterModelOptions(
name='reminder',
options={'permissions': (('view_reminder', 'Can view a reminder object'),), 'verbose_name': 'reminder', 'verbose_name_plural': 'reminders'},
),
migrations.AlterModelOptions(
name='switchmanagementcred',
options={'permissions': (('view_switchmanagementcred', 'Can view a switch management credentials object'),), 'verbose_name': 'switch management credentials'},
),
migrations.AlterField(
model_name='mailmessageoption',
name='welcome_mail_en',
field=models.TextField(default='', help_text='Welcome email in English'),
),
migrations.AlterField(
model_name='mailmessageoption',
name='welcome_mail_fr',
field=models.TextField(default='', help_text='Welcome email in French'),
),
migrations.AlterField(
model_name='optionaltopologie',
name='sftp_login',
field=models.CharField(blank=True, help_text='SFTP login for switches', max_length=32, null=True),
),
migrations.AlterField(
model_name='optionaltopologie',
name='sftp_pass',
field=re2o.aes_field.AESEncryptedField(blank=True, help_text='SFTP password', max_length=63, null=True),
),
migrations.AlterField(
model_name='optionaltopologie',
name='switchs_ip_type',
field=models.OneToOneField(blank=True, help_text='IP range for the management of switches', null=True, on_delete=django.db.models.deletion.PROTECT, to='machines.IpType'),
),
migrations.AlterField(
model_name='optionaltopologie',
name='switchs_provision',
field=models.CharField(choices=[('sftp', 'sftp'), ('tftp', 'tftp')], default='tftp', help_text='Provision of configuration mode for switches', max_length=32),
),
migrations.AlterField(
model_name='optionaltopologie',
name='switchs_rest_management',
field=models.BooleanField(default=False, help_text='REST management, activated in case of automatic provision'),
),
migrations.AlterField(
model_name='optionaltopologie',
name='switchs_web_management',
field=models.BooleanField(default=False, help_text='Web management, activated in case of automatic provision'),
),
migrations.AlterField(
model_name='optionaltopologie',
name='switchs_web_management_ssl',
field=models.BooleanField(default=False, help_text='SSL web management, make sure that a certificate is installed on the switch'),
),
migrations.AlterField(
model_name='optionaluser',
name='all_can_create_adherent',
field=models.BooleanField(default=False, help_text='Users can create a member.'),
),
migrations.AlterField(
model_name='optionaluser',
name='all_can_create_club',
field=models.BooleanField(default=False, help_text='Users can create a club.'),
),
migrations.AlterField(
model_name='optionaluser',
name='all_users_active',
field=models.BooleanField(default=False, help_text='If True, all new created and connected users are active. If False, only when a valid registration has been paid.'),
),
migrations.AlterField(
model_name='optionaluser',
name='delete_notyetactive',
field=models.IntegerField(default=15, help_text='Not yet active users will be deleted after this number of days.'),
),
migrations.AlterField(
model_name='optionaluser',
name='local_email_accounts_enabled',
field=models.BooleanField(default=False, help_text='Enable local email accounts for users.'),
),
migrations.AlterField(
model_name='optionaluser',
name='max_email_address',
field=models.IntegerField(default=15, help_text='Maximum number of local email addresses for a standard user.'),
),
migrations.AlterField(
model_name='optionaluser',
name='self_adhesion',
field=models.BooleanField(default=False, help_text='A new user can create their account on Re2o.'),
),
migrations.AlterField(
model_name='optionaluser',
name='self_change_room',
field=models.BooleanField(default=False, help_text='Users can edit their room.'),
),
migrations.AlterField(
model_name='optionaluser',
name='self_change_shell',
field=models.BooleanField(default=False, help_text='Users can edit their shell.'),
),
migrations.AlterField(
model_name='radiuskey',
name='comment',
field=models.CharField(blank=True, help_text='Comment for this key', max_length=255, null=True),
),
migrations.AlterField(
model_name='radiuskey',
name='default_switch',
field=models.BooleanField(default=True, help_text='Default key for switches', unique=True),
),
migrations.AlterField(
model_name='radiuskey',
name='radius_key',
field=re2o.aes_field.AESEncryptedField(help_text='RADIUS key', max_length=255),
),
migrations.AlterField(
model_name='radiusoption',
name='banned',
field=models.CharField(choices=[('REJECT', 'Reject the machine'), ('SET_VLAN', 'Place the machine on the VLAN')], default='REJECT', max_length=32, verbose_name='Policy for banned users'),
),
migrations.AlterField(
model_name='radiusoption',
name='banned_vlan',
field=models.ForeignKey(blank=True, help_text='VLAN for banned users if not rejected', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='banned_vlan', to='machines.Vlan', verbose_name='Banned users VLAN'),
),
migrations.AlterField(
model_name='radiusoption',
name='non_member',
field=models.CharField(choices=[('REJECT', 'Reject the machine'), ('SET_VLAN', 'Place the machine on the VLAN')], default='REJECT', max_length=32, verbose_name='Policy for non members'),
),
migrations.AlterField(
model_name='radiusoption',
name='non_member_vlan',
field=models.ForeignKey(blank=True, help_text='VLAN for non members if not rejected', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='non_member_vlan', to='machines.Vlan', verbose_name='Non members VLAN'),
),
migrations.AlterField(
model_name='radiusoption',
name='unknown_machine_vlan',
field=models.ForeignKey(blank=True, help_text='VLAN for unknown machines if not rejected', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='unknown_machine_vlan', to='machines.Vlan', verbose_name='Unknown machines VLAN'),
),
migrations.AlterField(
model_name='radiusoption',
name='unknown_port',
field=models.CharField(choices=[('REJECT', 'Reject the machine'), ('SET_VLAN', 'Place the machine on the VLAN')], default='REJECT', max_length=32, verbose_name='Policy for unknown ports'),
),
migrations.AlterField(
model_name='radiusoption',
name='unknown_port_vlan',
field=models.ForeignKey(blank=True, help_text='VLAN for unknown ports if not rejected', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='unknown_port_vlan', to='machines.Vlan', verbose_name='Unknown ports VLAN'),
),
migrations.AlterField(
model_name='radiusoption',
name='unknown_room',
field=models.CharField(choices=[('REJECT', 'Reject the machine'), ('SET_VLAN', 'Place the machine on the VLAN')], default='REJECT', max_length=32, verbose_name='Policy for machines connecting from unregistered rooms (relevant on ports with STRICT RADIUS mode)'),
),
migrations.AlterField(
model_name='radiusoption',
name='unknown_room_vlan',
field=models.ForeignKey(blank=True, help_text='VLAN for unknown rooms if not rejected', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='unknown_room_vlan', to='machines.Vlan', verbose_name='Unknown rooms VLAN'),
),
migrations.AlterField(
model_name='reminder',
name='days',
field=models.IntegerField(default=7, help_text="Delay between the email and the membership's end", unique=True),
),
migrations.AlterField(
model_name='reminder',
name='message',
field=models.CharField(blank=True, default='', help_text='Message displayed specifically for this reminder', max_length=255, null=True),
),
migrations.AlterField(
model_name='switchmanagementcred',
name='default_switch',
field=models.BooleanField(default=True, help_text='Default credentials for switches', unique=True),
),
migrations.AlterField(
model_name='switchmanagementcred',
name='management_id',
field=models.CharField(help_text='Switch login', max_length=63),
),
migrations.AlterField(
model_name='switchmanagementcred',
name='management_pass',
field=re2o.aes_field.AESEncryptedField(help_text='Password', max_length=63),
),
]
......@@ -73,11 +73,11 @@ class OptionalUser(AclMixin, PreferencesModel):
gpg_fingerprint = models.BooleanField(default=True)
all_can_create_club = models.BooleanField(
default=False,
help_text=_("Users can create a club")
help_text=_("Users can create a club.")
)
all_can_create_adherent = models.BooleanField(
default=False,
help_text=_("Users can create a member"),
help_text=_("Users can create a member."),
)
shell_default = models.OneToOneField(
......@@ -88,15 +88,15 @@ class OptionalUser(AclMixin, PreferencesModel):
)
self_change_shell = models.BooleanField(
default=False,
help_text=_("Users can edit their shell")
help_text=_("Users can edit their shell.")
)
self_change_room = models.BooleanField(
default=False,
help_text=_("Users can edit their room")
help_text=_("Users can edit their room.")
)
local_email_accounts_enabled = models.BooleanField(
default=False,
help_text=_("Enable local email accounts for users")
help_text=_("Enable local email accounts for users.")
)
local_email_domain = models.CharField(
max_length=32,
......@@ -106,20 +106,21 @@ class OptionalUser(AclMixin, PreferencesModel):
max_email_address = models.IntegerField(
default=15,
help_text=_("Maximum number of local email addresses for a standard"
" user")
" user.")
)
delete_notyetactive = models.IntegerField(
default=15,
help_text=_("Inactive users will be deleted after this number of days")
help_text=_("Not yet active users will be deleted after this number of"
" days.")
)
self_adhesion = models.BooleanField(
default=False,
help_text=_("A new user can create their account on Re2o")
help_text=_("A new user can create their account on Re2o.")
)
all_users_active = models.BooleanField(
default=False,
help_text=_("If True, all new created and connected users are active.\
If False, only when a valid registration has been paid")
help_text=_("If True, all new created and connected users are active."
" If False, only when a valid registration has been paid.")
)
class Meta:
......@@ -206,40 +207,41 @@ class OptionalTopologie(AclMixin, PreferencesModel):
switchs_web_management = models.BooleanField(
default=False,
help_text="Web management, activé si provision automatique"
help_text=_("Web management, activated in case of automatic provision")
)
switchs_web_management_ssl = models.BooleanField(
default=False,
help_text="Web management ssl. Assurez-vous que un certif est installé sur le switch !"
help_text=_("SSL web management, make sure that a certificate is"
" installed on the switch")
)
switchs_rest_management = models.BooleanField(
default=False,
help_text="Rest management, activé si provision auto"
help_text=_("REST management, activated in case of automatic provision")
)
switchs_ip_type = models.OneToOneField(
'machines.IpType',
on_delete=models.PROTECT,
blank=True,
null=True,
help_text="Plage d'ip de management des switchs"
help_text=_("IP range for the management of switches")
)
switchs_provision = models.CharField(
max_length=32,
choices=CHOICE_PROVISION,
default='tftp',
help_text="Mode de récupération des confs par les switchs"
help_text=_("Provision of configuration mode for switches")
)
sftp_login = models.CharField(
max_length=32,
null=True,
blank=True,
help_text="Login sftp des switchs"
help_text=_("SFTP login for switches")
)
sftp_pass = AESEncryptedField(
max_length=63,
null=True,
blank=True,
help_text="Mot de passe sftp"
help_text=_("SFTP password")
)
@cached_property
......@@ -314,52 +316,56 @@ class RadiusKey(AclMixin, models.Model):
"""Class of a radius key"""
radius_key = AESEncryptedField(
max_length=255,
help_text="Clef radius"
help_text=_("RADIUS key")
)
comment = models.CharField(
max_length=255,
null=True,
blank=True,
help_text="Commentaire de cette clef"
help_text=_("Comment for this key")
)
default_switch = models.BooleanField(
default=True,
unique=True,
help_text= "Clef par défaut des switchs"
help_text=_("Default key for switches")
)
class Meta:
permissions = (
("view_radiuskey", "Peut voir un objet radiuskey"),
("view_radiuskey", _("Can view a RADIUS key object")),
)
verbose_name = _("RADIUS key")
verbose_name_plural = _("RADIUS keys")
def __str__(self):
return "Clef radius " + str(self.id) + " " + str(self.comment)
return _("RADIUS key ") + str(self.id) + " " + str(self.comment)
class SwitchManagementCred(AclMixin, models.Model):
"""Class of a management creds of a switch, for rest management"""
management_id = models.CharField(
max_length=63,
help_text="Login du switch"
help_text=_("Switch login")
)
management_pass = AESEncryptedField(
max_length=63,
help_text="Mot de passe"
help_text=_("Password")
)
default_switch = models.BooleanField(
default=True,
unique=True,
help_text= "Creds par défaut des switchs"
help_text=_("Default credentials for switches")
)
class Meta:
permissions = (
("view_switchmanagementcred", "Peut voir un objet switchmanagementcred"),
("view_switchmanagementcred", _("Can view a switch management"
" credentials object")),
)
verbose_name = _("switch management credentials")
def __str__(self):
return "Identifiant " + str(self.management_id)
return _("Switch login ") + str(self.management_id)
class Reminder(AclMixin, models.Model):
......@@ -367,25 +373,26 @@ class Reminder(AclMixin, models.Model):
Days: liste des nombres de jours pour lesquells un mail est envoyé
optionalMessage: message additionel pour le mail
"""
PRETTY_NAME="Options pour le mail de fin d'adhésion"
days = models.IntegerField(
default=7,
unique=True,
help_text="Délais entre le mail et la fin d'adhésion"
help_text=_("Delay between the email and the membership's end")
)
message = models.CharField(
max_length=255,
default="",
null=True,
blank=True,
help_text="Message affiché spécifiquement pour ce rappel"
help_text=_("Message displayed specifically for this reminder")
)
class Meta:
permissions = (
("view_reminder", "Peut voir un objet reminder"),
("view_reminder", _("Can view a reminder object")),
)
verbose_name = _("reminder")
verbose_name_plural = _("reminders")
def users_to_remind(self):
from re2o.utils import all_has_access
......@@ -472,8 +479,7 @@ class MailContact(AclMixin, models.Model):
commentary = models.CharField(
blank = True,
null = True,
help_text = _(
"Description of the associated email address."),
help_text = _("Description of the associated email address."),
max_length = 256
)
......@@ -564,8 +570,8 @@ def homeoption_post_save(**kwargs):
class MailMessageOption(AclMixin, models.Model):
"""Reglages, mail de bienvenue et autre"""
welcome_mail_fr = models.TextField(default="", help_text="Mail de bienvenue en français")
welcome_mail_en = models.TextField(default="", help_text="Mail de bienvenue en anglais")
welcome_mail_fr = models.TextField(default="", help_text=_("Welcome email in French"))
welcome_mail_en = models.TextField(default="", help_text=_("Welcome email in English"))
class Meta:
permissions = (
......@@ -577,7 +583,8 @@ class MailMessageOption(AclMixin, models.Model):
class RadiusOption(AclMixin, PreferencesModel):
class Meta:
verbose_name = _("radius policies")
verbose_name = _("RADIUS policy")
verbose_name_plural = _("RADIUS policies")
MACHINE = 'MACHINE'
DEFINED = 'DEFINED'
......@@ -588,8 +595,8 @@ class RadiusOption(AclMixin, PreferencesModel):
REJECT = 'REJECT'
SET_VLAN = 'SET_VLAN'
CHOICE_POLICY = (
(REJECT, _('Reject the machine')),
(SET_VLAN, _('Place the machine on the VLAN'))
(REJECT, _("Reject the machine")),
(SET_VLAN, _("Place the machine on the VLAN"))
)
radius_general_policy = models.CharField(
max_length=32,
......@@ -608,16 +615,14 @@ class RadiusOption(AclMixin, PreferencesModel):
related_name='unknown_machine_vlan',
blank=True,
null=True,
verbose_name=_('Unknown machine Vlan'),
help_text=_(
'Vlan for unknown machines if not rejected.'
)
verbose_name=_("Unknown machines VLAN"),
help_text=_("VLAN for unknown machines if not rejected")
)
unknown_port = models.CharField(
max_length=32,
choices=CHOICE_POLICY,
default=REJECT,
verbose_name=_("Policy for unknown port"),
verbose_name=_("Policy for unknown ports"),
)
unknown_port_vlan = models.ForeignKey(
'machines.Vlan',
......@@ -625,20 +630,15 @@ class RadiusOption(AclMixin, PreferencesModel):
related_name='unknown_port_vlan',
blank=True,
null=True,
verbose_name=_('Unknown port Vlan'),
help_text=_(
'Vlan for unknown ports if not rejected.'
)
verbose_name=_("Unknown ports VLAN"),
help_text=_("VLAN for unknown ports if not rejected")
)
unknown_room = models.CharField(
max_length=32,
choices=CHOICE_POLICY,
default=REJECT,
verbose_name=_(
"Policy for machine connecting from "
"unregistered room (relevant on ports with STRICT "
"radius mode)"
),
verbose_name=_("Policy for machines connecting from unregistered rooms"
" (relevant on ports with STRICT RADIUS mode)"),
)
unknown_room_vlan = models.ForeignKey(
'machines.Vlan',
......@@ -646,16 +646,14 @@ class RadiusOption(AclMixin, PreferencesModel):
on_delete=models.PROTECT,
blank=True,
null=True,
verbose_name=_('Unknown room Vlan'),
help_text=_(
'Vlan for unknown room if not rejected.'
)
verbose_name=_("Unknown rooms VLAN"),
help_text=_("VLAN for unknown rooms if not rejected")
)
non_member = models.CharField(
max_length=32,
choices=CHOICE_POLICY,
default=REJECT,
verbose_name=_("Policy non member users."),
verbose_name=_("Policy for non members"),
)
non_member_vlan = models.ForeignKey(
'machines.Vlan',
......@@ -663,16 +661,14 @@ class RadiusOption(AclMixin, PreferencesModel):
on_delete=models.PROTECT,
blank=True,
null=True,
verbose_name=_('Non member Vlan'),
help_text=_(
'Vlan for non members if not rejected.'
)
verbose_name=_("Non members VLAN"),
help_text=_("VLAN for non members if not rejected")
)
banned = models.CharField(
max_length=32,
choices=CHOICE_POLICY,
default=REJECT,
verbose_name=_("Policy for banned users."),
verbose_name=_("Policy for banned users"),
)
banned_vlan = models.ForeignKey(
'machines.Vlan',
......@@ -680,10 +676,8 @@ class RadiusOption(AclMixin, PreferencesModel):
on_delete=models.PROTECT,
blank=True,
null=True,
verbose_name=_('Banned Vlan'),
help_text=_(
'Vlan for banned if not rejected.'
)
verbose_name=_("Banned users VLAN"),
help_text=_("VLAN for banned users if not rejected")
)
vlan_decision_ok = models.OneToOneField(
'machines.Vlan',
......
......@@ -23,35 +23,35 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Id Clef</th>
<th>Commentaire</th>
<th>Clef par default des switchs</th>
<th>Clef utilisée par les switchs</th>
<th></th>
<th></th>
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "RADIUS key ID" %}</th>
<th>{% trans "Comment" %}</th>
<th>{% trans "Default RADIUS key for switches" %}</th>
<th>{% trans "RADIUS key used by the swithes" %}</th>
<th></th>
<th></th>
</tr>
</thead>
{% for radiuskey in radiuskey_list %}
</thead>
{% for radiuskey in radiuskey_list %}
<tr>
<td>{{ radiuskey.id }}</td>
<td>{{ radiuskey.comment }}</td>
<td>{{ radiuskey.default_switch }}</td>
<td>{{ radiuskey.switch_set.all|join:", " }}</td>
<td>{{ radiuskey.switch_set.all|join:", " }}</td>
<td class="text-right">
{% can_edit radiuskey %}
{% include 'buttons/edit.html' with href='preferences:edit-radiuskey' id=radiuskey.id %}
{% acl_end %}
{% can_delete radiuskey %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'preferences:del-radiuskey' radiuskey.pk %}">
<i class="fa fa-trash"></i>