8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +00:00

Fix synthax + english

This commit is contained in:
Gabriel Detraz 2018-07-29 19:13:09 +02:00 committed by Maël Kervella
parent 13aa05a109
commit bd19b27914
7 changed files with 24 additions and 26 deletions

View file

@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='optionaluser', model_name='optionaluser',
name='mail_extension', 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),
), ),
] ]

View file

@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='optionaluser', model_name='optionaluser',
name='mail_accounts', 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'),
), ),
] ]

View file

@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='optionaluser', model_name='optionaluser',
name='max_mail_alias', 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"),
), ),
] ]

View file

@ -87,16 +87,16 @@ class OptionalUser(AclMixin, PreferencesModel):
) )
mail_accounts = models.BooleanField( mail_accounts = models.BooleanField(
default=False, default=False,
help_text="Activation des comptes mails pour les utilisateurs" help_text="Enable mail accounts for users"
) )
mail_extension = models.CharField( mail_extension = models.CharField(
max_length = 32, max_length = 32,
default = "@example.org", default = "@example.org",
help_text="Extension principale pour les mails internes", help_text="Main extension for internal address",
) )
max_mail_alias = models.IntegerField( max_mail_alias = models.IntegerField(
default = 15, default = 15,
help_text = "Nombre maximal d'alias pour un utilisateur lambda" help_text = "Max alias mail for a lambda user"
) )
class Meta: class Meta:
@ -105,12 +105,11 @@ class OptionalUser(AclMixin, PreferencesModel):
) )
def clean(self): def clean(self):
"""Clean du model: """Clean model:
Creation du mode de paiement par solde Check the mail_extension
Vérifie que l'extension mail commence bien par @
""" """
if self.mail_extension[0] != "@": 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) @receiver(post_save, sender=OptionalUser)

View file

@ -591,26 +591,26 @@ class WhitelistForm(FormRevMixin, ModelForm):
class MailAliasForm(FormRevMixin, ModelForm): class MailAliasForm(FormRevMixin, ModelForm):
"""Creation, edition d'un objet alias mail""" """Create and edit a mailalias"""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__) prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(MailAliasForm, self).__init__(*args, prefix=prefix, **kwargs) 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: class Meta:
model = MailAlias model = MailAlias
exclude = ['user'] exclude = ['user']
class MailForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): class MailForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Creation, edition des paramètres mail""" """Edit mail settings"""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__) prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(MailForm, self).__init__(*args, prefix=prefix, **kwargs) 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: 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: if 'internal_address' in self.fields:
self.fields['internal_address'].label = 'Adresse mail interne' self.fields['internal_address'].label = 'Internal mail address'
class Meta: class Meta:
model = User model = User

View file

@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %} {% load bootstrap3 %}
{% block title %}Utilisateurs{% endblock %} {% block title %}Users{% endblock %}
{% block content %} {% block content %}
<h2>Alias</h2> <h2>Alias</h2>

View file

@ -499,7 +499,7 @@ def del_whitelist(request, whitelist, **_kwargs):
@can_create(MailAlias) @can_create(MailAlias)
@can_edit(User) @can_edit(User)
def add_mailalias(request, user, userid): def add_mailalias(request, user, userid):
""" Créer un alias """ """ Create a new alias"""
mailalias_instance = MailAlias(user=user) mailalias_instance = MailAlias(user=user)
mailalias = MailAliasForm( mailalias = MailAliasForm(
request.POST or None, request.POST or None,
@ -507,13 +507,13 @@ def add_mailalias(request, user, userid):
) )
if mailalias.is_valid(): if mailalias.is_valid():
mailalias.save() mailalias.save()
messages.success(request, "Alias créé") messages.success(request, "Alias created")
return redirect(reverse( return redirect(reverse(
'users:profil', 'users:profil',
kwargs={'userid': str(userid)} kwargs={'userid': str(userid)}
)) ))
return form( return form(
{'userform': mailalias, 'action_name': 'Ajouter un alias mail'}, {'userform': mailalias, 'action_name': 'Add an alias mail'},
'users/user.html', 'users/user.html',
request request
) )
@ -521,7 +521,7 @@ def add_mailalias(request, user, userid):
@login_required @login_required
@can_edit(MailAlias) @can_edit(MailAlias)
def edit_mailalias(request, mailalias_instance, **_kwargs): def edit_mailalias(request, mailalias_instance, **_kwargs):
""" Editer un alias mail""" """ Edit a mailalias"""
mailalias = MailAliasForm( mailalias = MailAliasForm(
request.POST or None, request.POST or None,
instance=mailalias_instance instance=mailalias_instance
@ -529,13 +529,13 @@ def edit_mailalias(request, mailalias_instance, **_kwargs):
if mailalias.is_valid(): if mailalias.is_valid():
if mailalias.changed_data: if mailalias.changed_data:
mailalias.save() mailalias.save()
messages.success(request, "Alias modifiée") messages.success(request, "Alias modified")
return redirect(reverse( return redirect(reverse(
'users:profil', 'users:profil',
kwargs={'userid': str(mailalias_instance.user.id)} kwargs={'userid': str(mailalias_instance.user.id)}
)) ))
return form( return form(
{'userform': mailalias, 'action_name': 'Editer un alias mail'}, {'userform': mailalias, 'action_name': 'Edit a mailalias'},
'users/user.html', 'users/user.html',
request request
) )
@ -543,10 +543,10 @@ def edit_mailalias(request, mailalias_instance, **_kwargs):
@login_required @login_required
@can_delete(MailAlias) @can_delete(MailAlias)
def del_mailalias(request, mailalias, **_kwargs): def del_mailalias(request, mailalias, **_kwargs):
""" Supprime un alias mail""" """Delete a mail alias"""
if request.method == "POST": if request.method == "POST":
mailalias.delete() mailalias.delete()
messages.success(request, "L'alias a été supprimé") messages.success(request, "Alias deleted")
return redirect(reverse( return redirect(reverse(
'users:profil', 'users:profil',
kwargs={'userid': str(mailalias.user.id)} kwargs={'userid': str(mailalias.user.id)}
@ -1002,7 +1002,6 @@ def profil(request, users, **_kwargs):
'white_list': whitelists, 'white_list': whitelists,
'user_solde': user_solde, 'user_solde': user_solde,
'solde_activated': Paiement.objects.filter(is_balance=True).exists(), 'solde_activated': Paiement.objects.filter(is_balance=True).exists(),
'asso_name': AssoOption.objects.first().name
'allow_online_payment': allow_online_payment, 'allow_online_payment': allow_online_payment,
'asso_name': AssoOption.objects.first().name, 'asso_name': AssoOption.objects.first().name,
'alias_list': users.mailalias_set.all(), 'alias_list': users.mailalias_set.all(),