Commit bd19b279 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by Maël Kervella

Fix synthax + english

parent 13aa05a1
......@@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='optionaluser',
name='mail_extension',
field=models.CharField(default='@example.org', help_text='Extension principale pour les mails internes', max_length=32),
field=models.CharField(default='@example.org', help_text='Main extension for internal address', max_length=32),
),
]
......@@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='optionaluser',
name='mail_accounts',
field=models.BooleanField(default=False, help_text='Activation des comptes mails pour les utilisateurs'),
field=models.BooleanField(default=False, help_text='Enable mail accounts for users'),
),
]
......@@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='optionaluser',
name='max_mail_alias',
field=models.IntegerField(default=15, help_text="Nombre maximal d'alias pour un utilisateur lambda"),
field=models.IntegerField(default=15, help_text="Max alias mail for a lambda user"),
),
]
......@@ -87,16 +87,16 @@ class OptionalUser(AclMixin, PreferencesModel):
)
mail_accounts = models.BooleanField(
default=False,
help_text="Activation des comptes mails pour les utilisateurs"
help_text="Enable mail accounts for users"
)
mail_extension = models.CharField(
max_length = 32,
default = "@example.org",
help_text="Extension principale pour les mails internes",
help_text="Main extension for internal address",
)
max_mail_alias = models.IntegerField(
default = 15,
help_text = "Nombre maximal d'alias pour un utilisateur lambda"
help_text = "Max alias mail for a lambda user"
)
class Meta:
......@@ -105,12 +105,11 @@ class OptionalUser(AclMixin, PreferencesModel):
)
def clean(self):
"""Clean du model:
Creation du mode de paiement par solde
Vérifie que l'extension mail commence bien par @
"""Clean model:
Check the mail_extension
"""
if self.mail_extension[0] != "@":
raise ValidationError("L'extension mail doit commencer par un @")
raise ValidationError("Mail extension must begin with @")
@receiver(post_save, sender=OptionalUser)
......
......@@ -591,26 +591,26 @@ class WhitelistForm(FormRevMixin, ModelForm):
class MailAliasForm(FormRevMixin, ModelForm):
"""Creation, edition d'un objet alias mail"""
"""Create and edit a mailalias"""
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(MailAliasForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['valeur'].label = "Prefixe de l'alias mail. Ne peut contenir de @"
self.fields['valeur'].label = "Prefix of mailalias. Can't contain @"
class Meta:
model = MailAlias
exclude = ['user']
class MailForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Creation, edition des paramètres mail"""
"""Edit mail settings"""
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(MailForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['external_mail'].label = 'Adresse mail externe'
self.fields['external_mail'].label = 'External mail address'
if 'redirection' in self.fields:
self.fields['redirection'].label = 'Activation de la redirection vers l\'adress externe'
self.fields['redirection'].label = 'Enable redirect to external address'
if 'internal_address' in self.fields:
self.fields['internal_address'].label = 'Adresse mail interne'
self.fields['internal_address'].label = 'Internal mail address'
class Meta:
model = User
......
......@@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %}
{% block title %}Utilisateurs{% endblock %}
{% block title %}Users{% endblock %}
{% block content %}
<h2>Alias</h2>
......
......@@ -499,7 +499,7 @@ def del_whitelist(request, whitelist, **_kwargs):
@can_create(MailAlias)
@can_edit(User)
def add_mailalias(request, user, userid):
""" Créer un alias """
""" Create a new alias"""
mailalias_instance = MailAlias(user=user)
mailalias = MailAliasForm(
request.POST or None,
......@@ -507,13 +507,13 @@ def add_mailalias(request, user, userid):
)
if mailalias.is_valid():
mailalias.save()
messages.success(request, "Alias créé")
messages.success(request, "Alias created")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(userid)}
))
return form(
{'userform': mailalias, 'action_name': 'Ajouter un alias mail'},
{'userform': mailalias, 'action_name': 'Add an alias mail'},
'users/user.html',
request
)
......@@ -521,7 +521,7 @@ def add_mailalias(request, user, userid):
@login_required
@can_edit(MailAlias)
def edit_mailalias(request, mailalias_instance, **_kwargs):
""" Editer un alias mail"""
""" Edit a mailalias"""
mailalias = MailAliasForm(
request.POST or None,
instance=mailalias_instance
......@@ -529,13 +529,13 @@ def edit_mailalias(request, mailalias_instance, **_kwargs):
if mailalias.is_valid():
if mailalias.changed_data:
mailalias.save()
messages.success(request, "Alias modifiée")
messages.success(request, "Alias modified")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(mailalias_instance.user.id)}
))
return form(
{'userform': mailalias, 'action_name': 'Editer un alias mail'},
{'userform': mailalias, 'action_name': 'Edit a mailalias'},
'users/user.html',
request
)
......@@ -543,10 +543,10 @@ def edit_mailalias(request, mailalias_instance, **_kwargs):
@login_required
@can_delete(MailAlias)
def del_mailalias(request, mailalias, **_kwargs):
""" Supprime un alias mail"""
"""Delete a mail alias"""
if request.method == "POST":
mailalias.delete()
messages.success(request, "L'alias a été supprimé")
messages.success(request, "Alias deleted")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(mailalias.user.id)}
......@@ -1002,7 +1002,6 @@ def profil(request, users, **_kwargs):
'white_list': whitelists,
'user_solde': user_solde,
'solde_activated': Paiement.objects.filter(is_balance=True).exists(),
'asso_name': AssoOption.objects.first().name
'allow_online_payment': allow_online_payment,
'asso_name': AssoOption.objects.first().name,
'alias_list': users.mailalias_set.all(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment