From bd19b27914f07ec948a4a396bae59eee1c37e44e Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 29 Jul 2018 19:13:09 +0200 Subject: [PATCH] Fix synthax + english --- .../0035_optionaluser_mail_extension.py | 2 +- .../0036_optionaluser_mail_accounts.py | 2 +- .../0037_optionaluser_max_mail_alias.py | 2 +- preferences/models.py | 13 ++++++------- users/forms.py | 12 ++++++------ users/templates/users/index_alias.html | 2 +- users/views.py | 17 ++++++++--------- 7 files changed, 24 insertions(+), 26 deletions(-) diff --git a/preferences/migrations/0035_optionaluser_mail_extension.py b/preferences/migrations/0035_optionaluser_mail_extension.py index 3d1b42b4..dd26f433 100644 --- a/preferences/migrations/0035_optionaluser_mail_extension.py +++ b/preferences/migrations/0035_optionaluser_mail_extension.py @@ -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), ), ] diff --git a/preferences/migrations/0036_optionaluser_mail_accounts.py b/preferences/migrations/0036_optionaluser_mail_accounts.py index c3bf4fa8..db604287 100644 --- a/preferences/migrations/0036_optionaluser_mail_accounts.py +++ b/preferences/migrations/0036_optionaluser_mail_accounts.py @@ -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'), ), ] diff --git a/preferences/migrations/0037_optionaluser_max_mail_alias.py b/preferences/migrations/0037_optionaluser_max_mail_alias.py index 8d6ca609..f5198177 100644 --- a/preferences/migrations/0037_optionaluser_max_mail_alias.py +++ b/preferences/migrations/0037_optionaluser_max_mail_alias.py @@ -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"), ), ] diff --git a/preferences/models.py b/preferences/models.py index ebfae5fe..aa1a662b 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -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) diff --git a/users/forms.py b/users/forms.py index 144d5ecc..14a630bd 100644 --- a/users/forms.py +++ b/users/forms.py @@ -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 diff --git a/users/templates/users/index_alias.html b/users/templates/users/index_alias.html index dc9af095..52c68733 100644 --- a/users/templates/users/index_alias.html +++ b/users/templates/users/index_alias.html @@ -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 %}

Alias

diff --git a/users/views.py b/users/views.py index 09590be6..3a2b11f7 100644 --- a/users/views.py +++ b/users/views.py @@ -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(),