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

Mark strings for translation in preferences

This commit is contained in:
Laouen Fernet 2019-11-16 14:07:59 +00:00 committed by chirac
parent a745e8cc9c
commit 038a11fb75
10 changed files with 133 additions and 131 deletions

View file

@ -41,6 +41,7 @@ def can_view(user):
can = user.has_module_perms("preferences") can = user.has_module_perms("preferences")
return ( return (
can, can,
None if can else _("You don't have the right to view this" " application."), None if can else _("You don't have the right to view this"
" application."),
("preferences",), ("preferences",),
) )

View file

@ -81,13 +81,13 @@ class EditOptionalMachineForm(ModelForm):
prefix = kwargs.pop("prefix", self.Meta.model.__name__) prefix = kwargs.pop("prefix", self.Meta.model.__name__)
super(EditOptionalMachineForm, self).__init__(*args, prefix=prefix, **kwargs) super(EditOptionalMachineForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields["password_machine"].label = _( self.fields["password_machine"].label = _(
"Possibility to set a" " password per machine" "Possibility to set a password per machine"
) )
self.fields["max_lambdauser_interfaces"].label = _( self.fields["max_lambdauser_interfaces"].label = _(
"Maximum number of" " interfaces" " allowed for a" " standard user" "Maximum number of interfaces allowed for a standard user"
) )
self.fields["max_lambdauser_aliases"].label = _( self.fields["max_lambdauser_aliases"].label = _(
"Maximum number of DNS" " aliases allowed for" " a standard user" "Maximum number of DNS aliases allowed for a standard user"
) )
self.fields["ipv6_mode"].label = _("IPv6 mode") self.fields["ipv6_mode"].label = _("IPv6 mode")
self.fields["create_machine"].label = _("Can create a machine") self.fields["create_machine"].label = _("Can create a machine")
@ -136,20 +136,20 @@ class EditGeneralOptionForm(ModelForm):
self.fields["general_message_fr"].label = _("General message in French") self.fields["general_message_fr"].label = _("General message in French")
self.fields["general_message_en"].label = _("General message in English") self.fields["general_message_en"].label = _("General message in English")
self.fields["search_display_page"].label = _( self.fields["search_display_page"].label = _(
"Number of results" " displayed when" " searching" "Number of results displayed when searching"
) )
self.fields["pagination_number"].label = _( self.fields["pagination_number"].label = _(
"Number of items per page," " standard size (e.g." " users)" "Number of items per page, standard size (e.g. users)"
) )
self.fields["pagination_large_number"].label = _( self.fields["pagination_large_number"].label = _(
"Number of items per" " page, large size" " (e.g. machines)" "Number of items per page, large size (e.g. machines)"
) )
self.fields["req_expire_hrs"].label = _( self.fields["req_expire_hrs"].label = _(
"Time before expiration of the" " reset password link (in" " hours)" "Time before expiration of the reset password link (in hours)"
) )
self.fields["site_name"].label = _("Website name") self.fields["site_name"].label = _("Website name")
self.fields["email_from"].label = _("Email address for automatic" " emailing") self.fields["email_from"].label = _("Email address for automatic emailing")
self.fields["GTU_sum_up"].label = _("Summary of the General Terms of" " Use") self.fields["GTU_sum_up"].label = _("Summary of the General Terms of Use")
self.fields["GTU"].label = _("General Terms of Use") self.fields["GTU"].label = _("General Terms of Use")
@ -171,7 +171,7 @@ class EditAssoOptionForm(ModelForm):
self.fields["telephone"].label = _("Telephone number") self.fields["telephone"].label = _("Telephone number")
self.fields["pseudo"].label = _("Usual name") self.fields["pseudo"].label = _("Usual name")
self.fields["utilisateur_asso"].label = _( self.fields["utilisateur_asso"].label = _(
"Account used for editing" " from /admin" "Account used for editing from /admin"
) )
self.fields["description"].label = _("Description") self.fields["description"].label = _("Description")
@ -187,10 +187,10 @@ class EditMailMessageOptionForm(ModelForm):
prefix = kwargs.pop("prefix", self.Meta.model.__name__) prefix = kwargs.pop("prefix", self.Meta.model.__name__)
super(EditMailMessageOptionForm, self).__init__(*args, prefix=prefix, **kwargs) super(EditMailMessageOptionForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields["welcome_mail_fr"].label = _( self.fields["welcome_mail_fr"].label = _(
"Message for the French" " welcome email" "Message for the French welcome email"
) )
self.fields["welcome_mail_en"].label = _( self.fields["welcome_mail_en"].label = _(
"Message for the English" " welcome email" "Message for the English welcome email"
) )
@ -451,7 +451,7 @@ class DelDocumentTemplateForm(FormRevMixin, Form):
document_templates = forms.ModelMultipleChoiceField( document_templates = forms.ModelMultipleChoiceField(
queryset=DocumentTemplate.objects.none(), queryset=DocumentTemplate.objects.none(),
label=_("Available document templates"), label=_("Current document templates"),
widget=forms.CheckboxSelectMultiple, widget=forms.CheckboxSelectMultiple,
) )

View file

@ -95,16 +95,16 @@ class OptionalUser(AclMixin, PreferencesModel):
local_email_domain = models.CharField( local_email_domain = models.CharField(
max_length=32, max_length=32,
default="@example.org", default="@example.org",
help_text=_("Domain to use for local email accounts"), help_text=_("Domain to use for local email accounts."),
) )
max_email_address = models.IntegerField( max_email_address = models.IntegerField(
default=15, default=15,
help_text=_("Maximum number of local email addresses for a standard" " user."), help_text=_("Maximum number of local email addresses for a standard user."),
) )
delete_notyetactive = models.IntegerField( delete_notyetactive = models.IntegerField(
default=15, default=15,
help_text=_( help_text=_(
"Not yet active users will be deleted after this number of" " days." "Not yet active users will be deleted after this number of days."
), ),
) )
self_adhesion = models.BooleanField( self_adhesion = models.BooleanField(
@ -122,15 +122,15 @@ class OptionalUser(AclMixin, PreferencesModel):
) )
class Meta: class Meta:
permissions = (("view_optionaluser", _("Can view the user options")),) permissions = (("view_optionaluser", _("Can view the user preferences")),)
verbose_name = _("user options") verbose_name = _("user preferences")
def clean(self): def clean(self):
"""Clean model: """Clean model:
Check the mail_extension Check the mail_extension
""" """
if self.local_email_domain[0] != "@": if self.local_email_domain[0] != "@":
raise ValidationError(_("Email domain must begin with @")) raise ValidationError(_("Email domain must begin with @."))
@receiver(post_save, sender=OptionalUser) @receiver(post_save, sender=OptionalUser)
@ -148,8 +148,8 @@ class OptionalMachine(AclMixin, PreferencesModel):
DHCPV6 = "DHCPV6" DHCPV6 = "DHCPV6"
DISABLED = "DISABLED" DISABLED = "DISABLED"
CHOICE_IPV6 = ( CHOICE_IPV6 = (
(SLAAC, _("Autoconfiguration by RA")), (SLAAC, _("Automatic configuration by RA")),
(DHCPV6, _("IP addresses assigning by DHCPv6")), (DHCPV6, _("IP addresses assignment by DHCPv6")),
(DISABLED, _("Disabled")), (DISABLED, _("Disabled")),
) )
@ -159,7 +159,7 @@ class OptionalMachine(AclMixin, PreferencesModel):
ipv6_mode = models.CharField(max_length=32, choices=CHOICE_IPV6, default="DISABLED") ipv6_mode = models.CharField(max_length=32, choices=CHOICE_IPV6, default="DISABLED")
create_machine = models.BooleanField(default=True) create_machine = models.BooleanField(default=True)
default_dns_ttl = models.PositiveIntegerField( default_dns_ttl = models.PositiveIntegerField(
verbose_name=_("Default Time To Live (TTL) for CNAME, A and AAA records."), verbose_name=_("default Time To Live (TTL) for CNAME, A and AAAA records"),
default=172800, # 2 days default=172800, # 2 days
) )
@ -169,8 +169,8 @@ class OptionalMachine(AclMixin, PreferencesModel):
return not self.get_cached_value("ipv6_mode") == "DISABLED" return not self.get_cached_value("ipv6_mode") == "DISABLED"
class Meta: class Meta:
permissions = (("view_optionalmachine", _("Can view the machine options")),) permissions = (("view_optionalmachine", _("Can view the machine preferences")),)
verbose_name = _("machine options") verbose_name = _("machine preferences")
@receiver(post_save, sender=OptionalMachine) @receiver(post_save, sender=OptionalMachine)
@ -191,43 +191,43 @@ class OptionalTopologie(AclMixin, PreferencesModel):
DEFINED = "DEFINED" DEFINED = "DEFINED"
CHOICE_RADIUS = ( CHOICE_RADIUS = (
(MACHINE, _("On the IP range's VLAN of the machine")), (MACHINE, _("On the IP range's VLAN of the machine")),
(DEFINED, _("Preset in 'VLAN for machines accepted by RADIUS'")), (DEFINED, _("Preset in \"VLAN for machines accepted by RADIUS\"")),
) )
CHOICE_PROVISION = (("sftp", "sftp"), ("tftp", "tftp")) CHOICE_PROVISION = (("sftp", "SFTP"), ("tftp", "TFTP"))
switchs_web_management = models.BooleanField( switchs_web_management = models.BooleanField(
default=False, default=False,
help_text=_("Web management, activated in case of automatic provision"), help_text=_("Web management, activated in case of automatic provision."),
) )
switchs_web_management_ssl = models.BooleanField( switchs_web_management_ssl = models.BooleanField(
default=False, default=False,
help_text=_( help_text=_(
"SSL web management, make sure that a certificate is" "SSL web management, make sure that a certificate is"
" installed on the switch" " installed on the switch."
), ),
) )
switchs_rest_management = models.BooleanField( switchs_rest_management = models.BooleanField(
default=False, default=False,
help_text=_("REST management, activated in case of automatic provision"), help_text=_("REST management, activated in case of automatic provision."),
) )
switchs_ip_type = models.OneToOneField( switchs_ip_type = models.OneToOneField(
"machines.IpType", "machines.IpType",
on_delete=models.PROTECT, on_delete=models.PROTECT,
blank=True, blank=True,
null=True, null=True,
help_text=_("IP range for the management of switches"), help_text=_("IP range for the management of switches."),
) )
switchs_provision = models.CharField( switchs_provision = models.CharField(
max_length=32, max_length=32,
choices=CHOICE_PROVISION, choices=CHOICE_PROVISION,
default="tftp", default="tftp",
help_text=_("Provision of configuration mode for switches"), help_text=_("Provision of configuration mode for switches."),
) )
sftp_login = models.CharField( sftp_login = models.CharField(
max_length=32, null=True, blank=True, help_text=_("SFTP login for switches") max_length=32, null=True, blank=True, help_text=_("SFTP login for switches.")
) )
sftp_pass = AESEncryptedField( sftp_pass = AESEncryptedField(
max_length=63, null=True, blank=True, help_text=_("SFTP password") max_length=63, null=True, blank=True, help_text=_("SFTP password.")
) )
@cached_property @cached_property
@ -331,8 +331,8 @@ class OptionalTopologie(AclMixin, PreferencesModel):
) )
class Meta: class Meta:
permissions = (("view_optionaltopologie", _("Can view the topology options")),) permissions = (("view_optionaltopologie", _("Can view the topology preferences")),)
verbose_name = _("topology options") verbose_name = _("topology preferences")
@receiver(post_save, sender=OptionalTopologie) @receiver(post_save, sender=OptionalTopologie)
@ -345,12 +345,12 @@ def optionaltopologie_post_save(**kwargs):
class RadiusKey(AclMixin, models.Model): class RadiusKey(AclMixin, models.Model):
"""Class of a radius key""" """Class of a radius key"""
radius_key = AESEncryptedField(max_length=255, help_text=_("RADIUS key")) radius_key = AESEncryptedField(max_length=255, help_text=_("RADIUS key."))
comment = models.CharField( comment = models.CharField(
max_length=255, null=True, blank=True, help_text=_("Comment for this key") max_length=255, null=True, blank=True, help_text=_("Comment for this key.")
) )
default_switch = models.BooleanField( default_switch = models.BooleanField(
default=False, help_text=_("Default key for switches") default=False, help_text=_("Default key for switches.")
) )
class Meta: class Meta:
@ -363,7 +363,7 @@ class RadiusKey(AclMixin, models.Model):
Check default switch is unique Check default switch is unique
""" """
if RadiusKey.objects.filter(default_switch=True).count() > 1: if RadiusKey.objects.filter(default_switch=True).count() > 1:
raise ValidationError(_("Default radiuskey for switchs already exist")) raise ValidationError(_("Default RADIUS key for switches already exists."))
def __str__(self): def __str__(self):
return _("RADIUS key ") + str(self.id) + " " + str(self.comment) return _("RADIUS key ") + str(self.id) + " " + str(self.comment)
@ -372,17 +372,17 @@ class RadiusKey(AclMixin, models.Model):
class SwitchManagementCred(AclMixin, models.Model): class SwitchManagementCred(AclMixin, models.Model):
"""Class of a management creds of a switch, for rest management""" """Class of a management creds of a switch, for rest management"""
management_id = models.CharField(max_length=63, help_text=_("Switch login")) management_id = models.CharField(max_length=63, help_text=_("Switch login."))
management_pass = AESEncryptedField(max_length=63, help_text=_("Password")) management_pass = AESEncryptedField(max_length=63, help_text=_("Password."))
default_switch = models.BooleanField( default_switch = models.BooleanField(
default=True, unique=True, help_text=_("Default credentials for switches") default=True, unique=True, help_text=_("Default credentials for switches.")
) )
class Meta: class Meta:
permissions = ( permissions = (
( (
"view_switchmanagementcred", "view_switchmanagementcred",
_("Can view a switch management" " credentials object"), _("Can view a switch management credentials object"),
), ),
) )
verbose_name = _("switch management credentials") verbose_name = _("switch management credentials")
@ -400,13 +400,13 @@ class Reminder(AclMixin, models.Model):
days = models.IntegerField( days = models.IntegerField(
default=7, default=7,
unique=True, unique=True,
help_text=_("Delay between the email and the membership's end"), help_text=_("Delay between the email and the membership's end."),
) )
message = models.TextField( message = models.TextField(
default="", default="",
null=True, null=True,
blank=True, blank=True,
help_text=_("Message displayed specifically for this reminder"), help_text=_("Message displayed specifically for this reminder."),
) )
class Meta: class Meta:
@ -434,7 +434,7 @@ class GeneralOption(AclMixin, PreferencesModel):
blank=True, blank=True,
help_text=_( help_text=_(
"General message displayed on the French version of the" "General message displayed on the French version of the"
" website (e.g. in case of maintenance)" " website (e.g. in case of maintenance)."
), ),
) )
general_message_en = models.TextField( general_message_en = models.TextField(
@ -442,7 +442,7 @@ class GeneralOption(AclMixin, PreferencesModel):
blank=True, blank=True,
help_text=_( help_text=_(
"General message displayed on the English version of the" "General message displayed on the English version of the"
" website (e.g. in case of maintenance)" " website (e.g. in case of maintenance)."
), ),
) )
search_display_page = models.IntegerField(default=15) search_display_page = models.IntegerField(default=15)
@ -456,8 +456,8 @@ class GeneralOption(AclMixin, PreferencesModel):
GTU = models.FileField(upload_to="", default="", null=True, blank=True) GTU = models.FileField(upload_to="", default="", null=True, blank=True)
class Meta: class Meta:
permissions = (("view_generaloption", _("Can view the general options")),) permissions = (("view_generaloption", _("Can view the general preferences")),)
verbose_name = _("general options") verbose_name = _("general preferences")
@receiver(post_save, sender=GeneralOption) @receiver(post_save, sender=GeneralOption)
@ -477,7 +477,7 @@ class Service(AclMixin, models.Model):
image = models.ImageField(upload_to="logo", blank=True) image = models.ImageField(upload_to="logo", blank=True)
class Meta: class Meta:
permissions = (("view_service", _("Can view the service options")),) permissions = (("view_service", _("Can view the service preferences")),)
verbose_name = _("service") verbose_name = _("service")
verbose_name_plural = _("services") verbose_name_plural = _("services")
@ -489,7 +489,7 @@ class MailContact(AclMixin, models.Model):
"""Contact email adress with a commentary.""" """Contact email adress with a commentary."""
address = models.EmailField( address = models.EmailField(
default="contact@example.org", help_text=_("Contact email address") default="contact@example.org", help_text=_("Contact email address.")
) )
commentary = models.CharField( commentary = models.CharField(
@ -516,17 +516,17 @@ class MailContact(AclMixin, models.Model):
class Mandate(RevMixin, AclMixin, models.Model): class Mandate(RevMixin, AclMixin, models.Model):
class Meta: class Meta:
verbose_name = _("Mandate") verbose_name = _("mandate")
verbose_name_plural = _("Mandates") verbose_name_plural = _("mandates")
permissions = (("view_mandate", _("Can view a mandate")),) permissions = (("view_mandate", _("Can view a mandate object")),)
president = models.ForeignKey( president = models.ForeignKey(
"users.User", "users.User",
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
null=True, null=True,
blank=True, blank=True,
verbose_name=_("President of the association"), verbose_name=_("president of the association"),
help_text=_("Displayed on subscription vouchers"), help_text=_("Displayed on subscription vouchers."),
) )
start_date = models.DateTimeField(verbose_name=_("start date")) start_date = models.DateTimeField(verbose_name=_("start date"))
end_date = models.DateTimeField(verbose_name=_("end date"), blank=True, null=True) end_date = models.DateTimeField(verbose_name=_("end date"), blank=True, null=True)
@ -542,7 +542,7 @@ class Mandate(RevMixin, AclMixin, models.Model):
) )
if not mandate: if not mandate:
raise cls.DoesNotExist( raise cls.DoesNotExist(
"No mandate have been created. Please go to the preferences page to create one." _("No mandates have been created. Please go to the preferences page to create one.")
) )
return mandate return mandate
@ -571,8 +571,8 @@ class AssoOption(AclMixin, PreferencesModel):
description = models.TextField(null=True, blank=True) description = models.TextField(null=True, blank=True)
class Meta: class Meta:
permissions = (("view_assooption", _("Can view the organisation options")),) permissions = (("view_assooption", _("Can view the organisation preferences")),)
verbose_name = _("organisation options") verbose_name = _("organisation preferences")
@receiver(post_save, sender=AssoOption) @receiver(post_save, sender=AssoOption)
@ -590,8 +590,8 @@ class HomeOption(AclMixin, PreferencesModel):
twitter_account_name = models.CharField(max_length=32, null=True, blank=True) twitter_account_name = models.CharField(max_length=32, null=True, blank=True)
class Meta: class Meta:
permissions = (("view_homeoption", _("Can view the homepage options")),) permissions = (("view_homeoption", _("Can view the homepage preferences")),)
verbose_name = _("homepage options") verbose_name = _("homepage preferences")
@receiver(post_save, sender=HomeOption) @receiver(post_save, sender=HomeOption)
@ -605,17 +605,17 @@ class MailMessageOption(AclMixin, models.Model):
"""Reglages, mail de bienvenue et autre""" """Reglages, mail de bienvenue et autre"""
welcome_mail_fr = models.TextField( welcome_mail_fr = models.TextField(
default="", blank=True, help_text=_("Welcome email in French") default="", blank=True, help_text=_("Welcome email in French.")
) )
welcome_mail_en = models.TextField( welcome_mail_en = models.TextField(
default="", blank=True, help_text=_("Welcome email in English") default="", blank=True, help_text=_("Welcome email in English.")
) )
class Meta: class Meta:
permissions = ( permissions = (
("view_mailmessageoption", _("Can view the email message" " options")), ("view_mailmessageoption", _("Can view the email message preferences")),
) )
verbose_name = _("email message options") verbose_name = _("email message preferences")
class RadiusAttribute(RevMixin, AclMixin, models.Model): class RadiusAttribute(RevMixin, AclMixin, models.Model):
@ -625,12 +625,12 @@ class RadiusAttribute(RevMixin, AclMixin, models.Model):
attribute = models.CharField( attribute = models.CharField(
max_length=255, max_length=255,
verbose_name=_("Attribute"), verbose_name=_("attribute"),
help_text=_("See http://freeradius.org/rfc/attributes.html"), help_text=_("See https://freeradius.org/rfc/attributes.html."),
) )
value = models.CharField(max_length=255, verbose_name=_("Value")) value = models.CharField(max_length=255, verbose_name=_("value"))
comment = models.TextField( comment = models.TextField(
verbose_name=_("Comment"), verbose_name=_("comment"),
help_text=_("Use this field to document this attribute."), help_text=_("Use this field to document this attribute."),
blank=True, blank=True,
default="", default="",
@ -649,7 +649,7 @@ class RadiusOption(AclMixin, PreferencesModel):
DEFINED = "DEFINED" DEFINED = "DEFINED"
CHOICE_RADIUS = ( CHOICE_RADIUS = (
(MACHINE, _("On the IP range's VLAN of the machine")), (MACHINE, _("On the IP range's VLAN of the machine")),
(DEFINED, _("Preset in 'VLAN for machines accepted by RADIUS'")), (DEFINED, _("Preset in \"VLAN for machines accepted by RADIUS\"")),
) )
REJECT = "REJECT" REJECT = "REJECT"
SET_VLAN = "SET_VLAN" SET_VLAN = "SET_VLAN"
@ -664,7 +664,7 @@ class RadiusOption(AclMixin, PreferencesModel):
max_length=32, max_length=32,
choices=CHOICE_POLICY, choices=CHOICE_POLICY,
default=REJECT, default=REJECT,
verbose_name=_("Policy for unknown machines"), verbose_name=_("policy for unknown machines"),
) )
unknown_machine_vlan = models.ForeignKey( unknown_machine_vlan = models.ForeignKey(
"machines.Vlan", "machines.Vlan",
@ -672,21 +672,21 @@ class RadiusOption(AclMixin, PreferencesModel):
related_name="unknown_machine_vlan", related_name="unknown_machine_vlan",
blank=True, blank=True,
null=True, null=True,
verbose_name=_("Unknown machines VLAN"), verbose_name=_("unknown machines VLAN"),
help_text=_("VLAN for unknown machines if not rejected"), help_text=_("VLAN for unknown machines if not rejected."),
) )
unknown_machine_attributes = models.ManyToManyField( unknown_machine_attributes = models.ManyToManyField(
RadiusAttribute, RadiusAttribute,
related_name="unknown_machine_attribute", related_name="unknown_machine_attribute",
blank=True, blank=True,
verbose_name=_("Unknown machines attributes."), verbose_name=_("unknown machines attributes"),
help_text=_("Answer attributes for unknown machines."), help_text=_("Answer attributes for unknown machines."),
) )
unknown_port = models.CharField( unknown_port = models.CharField(
max_length=32, max_length=32,
choices=CHOICE_POLICY, choices=CHOICE_POLICY,
default=REJECT, default=REJECT,
verbose_name=_("Policy for unknown ports"), verbose_name=_("policy for unknown ports"),
) )
unknown_port_vlan = models.ForeignKey( unknown_port_vlan = models.ForeignKey(
"machines.Vlan", "machines.Vlan",
@ -694,14 +694,14 @@ class RadiusOption(AclMixin, PreferencesModel):
related_name="unknown_port_vlan", related_name="unknown_port_vlan",
blank=True, blank=True,
null=True, null=True,
verbose_name=_("Unknown ports VLAN"), verbose_name=_("unknown ports VLAN"),
help_text=_("VLAN for unknown ports if not rejected"), help_text=_("VLAN for unknown ports if not rejected."),
) )
unknown_port_attributes = models.ManyToManyField( unknown_port_attributes = models.ManyToManyField(
RadiusAttribute, RadiusAttribute,
related_name="unknown_port_attribute", related_name="unknown_port_attribute",
blank=True, blank=True,
verbose_name=_("Unknown ports attributes."), verbose_name=_("unknown ports attributes"),
help_text=_("Answer attributes for unknown ports."), help_text=_("Answer attributes for unknown ports."),
) )
unknown_room = models.CharField( unknown_room = models.CharField(
@ -719,21 +719,21 @@ class RadiusOption(AclMixin, PreferencesModel):
on_delete=models.PROTECT, on_delete=models.PROTECT,
blank=True, blank=True,
null=True, null=True,
verbose_name=_("Unknown rooms VLAN"), verbose_name=_("unknown rooms VLAN"),
help_text=_("VLAN for unknown rooms if not rejected"), help_text=_("VLAN for unknown rooms if not rejected."),
) )
unknown_room_attributes = models.ManyToManyField( unknown_room_attributes = models.ManyToManyField(
RadiusAttribute, RadiusAttribute,
related_name="unknown_room_attribute", related_name="unknown_room_attribute",
blank=True, blank=True,
verbose_name=_("Unknown rooms attributes."), verbose_name=_("unknown rooms attributes"),
help_text=_("Answer attributes for unknown rooms."), help_text=_("Answer attributes for unknown rooms."),
) )
non_member = models.CharField( non_member = models.CharField(
max_length=32, max_length=32,
choices=CHOICE_POLICY, choices=CHOICE_POLICY,
default=REJECT, default=REJECT,
verbose_name=_("Policy for non members"), verbose_name=_("policy for non members"),
) )
non_member_vlan = models.ForeignKey( non_member_vlan = models.ForeignKey(
"machines.Vlan", "machines.Vlan",
@ -741,21 +741,21 @@ class RadiusOption(AclMixin, PreferencesModel):
on_delete=models.PROTECT, on_delete=models.PROTECT,
blank=True, blank=True,
null=True, null=True,
verbose_name=_("Non members VLAN"), verbose_name=_("non members VLAN"),
help_text=_("VLAN for non members if not rejected"), help_text=_("VLAN for non members if not rejected."),
) )
non_member_attributes = models.ManyToManyField( non_member_attributes = models.ManyToManyField(
RadiusAttribute, RadiusAttribute,
related_name="non_member_attribute", related_name="non_member_attribute",
blank=True, blank=True,
verbose_name=_("Non member attributes."), verbose_name=_("non members attributes"),
help_text=_("Answer attributes for non members."), help_text=_("Answer attributes for non members."),
) )
banned = models.CharField( banned = models.CharField(
max_length=32, max_length=32,
choices=CHOICE_POLICY, choices=CHOICE_POLICY,
default=REJECT, default=REJECT,
verbose_name=_("Policy for banned users"), verbose_name=_("policy for banned users"),
) )
banned_vlan = models.ForeignKey( banned_vlan = models.ForeignKey(
"machines.Vlan", "machines.Vlan",
@ -763,14 +763,14 @@ class RadiusOption(AclMixin, PreferencesModel):
on_delete=models.PROTECT, on_delete=models.PROTECT,
blank=True, blank=True,
null=True, null=True,
verbose_name=_("Banned users VLAN"), verbose_name=_("banned users VLAN"),
help_text=_("VLAN for banned users if not rejected"), help_text=_("VLAN for banned users if not rejected."),
) )
banned_attributes = models.ManyToManyField( banned_attributes = models.ManyToManyField(
RadiusAttribute, RadiusAttribute,
related_name="banned_attribute", related_name="banned_attribute",
blank=True, blank=True,
verbose_name=_("Banned attributes."), verbose_name=_("banned users attributes"),
help_text=_("Answer attributes for banned users."), help_text=_("Answer attributes for banned users."),
) )
vlan_decision_ok = models.OneToOneField( vlan_decision_ok = models.OneToOneField(
@ -784,7 +784,7 @@ class RadiusOption(AclMixin, PreferencesModel):
RadiusAttribute, RadiusAttribute,
related_name="ok_attribute", related_name="ok_attribute",
blank=True, blank=True,
verbose_name=_("Accepted users attributes."), verbose_name=_("accepted users attributes"),
help_text=_("Answer attributes for accepted users."), help_text=_("Answer attributes for accepted users."),
) )
@ -812,26 +812,27 @@ def default_voucher():
class CotisationsOption(AclMixin, PreferencesModel): class CotisationsOption(AclMixin, PreferencesModel):
class Meta: class Meta:
verbose_name = _("cotisations options") verbose_name = _("subscription preferences")
invoice_template = models.OneToOneField( invoice_template = models.OneToOneField(
"preferences.DocumentTemplate", "preferences.DocumentTemplate",
verbose_name=_("Template for invoices"), verbose_name=_("template for invoices"),
related_name="invoice_template", related_name="invoice_template",
on_delete=models.PROTECT, on_delete=models.PROTECT,
default=default_invoice, default=default_invoice,
) )
voucher_template = models.OneToOneField( voucher_template = models.OneToOneField(
"preferences.DocumentTemplate", "preferences.DocumentTemplate",
verbose_name=_("Template for subscription voucher"), verbose_name=_("template for subscription vouchers"),
related_name="voucher_template", related_name="voucher_template",
on_delete=models.PROTECT, on_delete=models.PROTECT,
default=default_voucher, default=default_voucher,
) )
send_voucher_mail = models.BooleanField( send_voucher_mail = models.BooleanField(
verbose_name=_("Send voucher by email when the invoice is controlled."), verbose_name=_("send voucher by email when the invoice is controlled"),
help_text=_( help_text=_(
"Be carefull, if no mandate is defined on the preferences page, errors will be triggered when generating vouchers." "Be careful, if no mandate is defined on the preferences page,"
" errors will be triggered when generating vouchers."
), ),
default=False, default=False,
) )

View file

@ -35,7 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for mandate in mandate_list %} {% for mandate in mandate_list %}
<tr> <tr>
<td>{{mandate.start_date|date:"d/m/Y"}}</td> <td>{{mandate.start_date|date:"d/m/Y"}}</td>
<td>{% if mandate.end_date %}{{mandate.end_date|date:"d/m/Y"}}{% else %}{% trans "In progress." %}{% endif %}</td> <td>{% if mandate.end_date %}{{mandate.end_date|date:"d/m/Y"}}{% else %}{% trans "In progress" %}{% endif %}</td>
<td><a href="{% url 'users:profil' userid=mandate.president.id %}">{{mandate.president.name}} {{mandate.president.surname}}</a></td> <td><a href="{% url 'users:profil' userid=mandate.president.id %}">{{mandate.president.name}} {{mandate.president.surname}}</a></td>
<td class="text-right"> <td class="text-right">
{% can_edit mandate%} {% can_edit mandate%}

View file

@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% trans "RADIUS key ID" %}</th> <th>{% trans "RADIUS key ID" %}</th>
<th>{% trans "Comment" %}</th> <th>{% trans "Comment" %}</th>
<th>{% trans "Default RADIUS key for switches" %}</th> <th>{% trans "Default RADIUS key for switches" %}</th>
<th>{% trans "RADIUS key used by the swithes" %}</th> <th>{% trans "Switches using the RADIUS key" %}</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>

View file

@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>{% trans "General policy for VLAN setting" %}</th> <th>{% trans "General policy for VLAN setting" %}</th>
<td>{{ radiusoptions.radius_general_policy }}</td> <td>{{ radiusoptions.radius_general_policy }}</td>
<td>{% trans "This setting defines the VLAN policy after acceptance by RADIUS: either on the IP range's VLAN of the machine, or a VLAN preset in 'VLAN for machines accepted by RADIUS'" %}</td> <td>{% blocktrans %}This setting defines the VLAN policy after acceptance by RADIUS: either on the IP range's VLAN of the machine, or a VLAN preset in "VLAN for machines accepted by RADIUS".{% endblocktrans %}</td>
</tr> </tr>
<tr> <tr>
<th>{% trans "VLAN for machines accepted by RADIUS" %}</th> <th>{% trans "VLAN for machines accepted by RADIUS" %}</th>

View file

@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>{% trans "Switch login" %}</th> <th>{% trans "Switch login" %}</th>
<th>{% trans "Default switch management credentials" %}</th> <th>{% trans "Default switch management credentials" %}</th>
<th>{% trans "Management credentials used by the switches" %}</th> <th>{% trans "Switches using the management credentials" %}</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>

View file

@ -125,7 +125,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>{% trans "All users are active by default" %}</th> <th>{% trans "All users are active by default" %}</th>
<td>{{ useroptions.all_users_active|tick }}</td> <td>{{ useroptions.all_users_active|tick }}</td>
<th>{% trans "Allow archived users to log-in" %}</th> <th>{% trans "Allow archived users to log in" %}</th>
<td>{{ useroptions.allow_archived_connexion|tick }}</td> <td>{{ useroptions.allow_archived_connexion|tick }}</td>
</tr> </tr>
</table> </table>
@ -156,7 +156,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel panel-default" id="machines"> <div class="panel panel-default" id="machines">
<div class="panel-heading" data-toggle="collapse" href="#collapse_machines"> <div class="panel-heading" data-toggle="collapse" href="#collapse_machines">
<h4 class ="panel-title"> <h4 class ="panel-title">
<a><i class="fa fa-desktop"></i> {% trans "Machines preferences" %}</a> <a><i class="fa fa-desktop"></i> {% trans "Machine preferences" %}</a>
</h4> </h4>
</div> </div>
@ -177,7 +177,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>{% trans "Maximum number of DNS aliases allowed for a standard user" %}</th> <th>{% trans "Maximum number of DNS aliases allowed for a standard user" %}</th>
<td>{{ machineoptions.max_lambdauser_aliases }}</td> <td>{{ machineoptions.max_lambdauser_aliases }}</td>
<th>{% trans "Default Time To Live (TTL) for CNAME, A and AAA records." %}</th> <th>{% trans "Default Time To Live (TTL) for CNAME, A and AAAA records." %}</th>
<td>{{ machineoptions.default_dns_ttl }}</td> <td>{{ machineoptions.default_dns_ttl }}</td>
</tr> </tr>
<tr> <tr>
@ -282,7 +282,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% trans "Edit" %} {% trans "Edit" %}
</a> </a>
{% include 'preferences/aff_radiusoptions.html' %} {% include 'preferences/aff_radiusoptions.html' %}
<h5>{% trans "Available RADIUS attributes"%}</h5> <h5>{% trans "Current RADIUS attributes"%}</h5>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:add-radiusattribute' %}"><i class="fa fa-plus"></i>{% trans "Add an attribute" %}</a> <a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:add-radiusattribute' %}"><i class="fa fa-plus"></i>{% trans "Add an attribute" %}</a>
{% include 'preferences/aff_radiusattributes.html' %} {% include 'preferences/aff_radiusattributes.html' %}
</div> </div>
@ -346,7 +346,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div id="collapse_templates" class="panel-collapse panel-body collapse"> <div id="collapse_templates" class="panel-collapse panel-body collapse">
{% can_create DocumentTemplate %} {% can_create DocumentTemplate %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:add-document-template' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'preferences:add-document-template' %}">
<i class="fa fa-cart-plus"></i> {% trans "Add a document template" %} <i class="fa fa-plus"></i> {% trans "Add a document template" %}
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'preferences:del-document-template' %}"> <a class="btn btn-danger btn-sm" role="button" href="{% url 'preferences:del-document-template' %}">
@ -359,7 +359,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel panel-default" id="cotisation"> <div class="panel panel-default" id="cotisation">
<div class="panel-heading" data-toggle="collapse" href="#collapse_cotisation"> <div class="panel-heading" data-toggle="collapse" href="#collapse_cotisation">
<h4 class="panel-title"> <h4 class="panel-title">
<a><i class="fa fa-eur"></i> {% trans "Cotisation's options" %}</a> <a><i class="fa fa-eur"></i> {% trans "Subscription preferences" %}</a>
</h4> </h4>
</div> </div>
<div id="collapse_cotisation" class="panel-collapse panel-body collapse"> <div id="collapse_cotisation" class="panel-collapse panel-body collapse">
@ -414,7 +414,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel panel-default" id="rappels"> <div class="panel panel-default" id="rappels">
<div class="panel-heading" data-toggle="collapse" href="#collapse_rappels"> <div class="panel-heading" data-toggle="collapse" href="#collapse_rappels">
<h4 class="panel-title"> <h4 class="panel-title">
<a><i class="fa fa-bell"></i> {% trans "Options for the membership's end email" %}</a> <a><i class="fa fa-bell"></i> {% trans "Preferences for the membership's end email" %}</a>
</h4> </h4>
</div> </div>
<div id="collapse_rappels" class="panel-collapse panel-body collapse"> <div id="collapse_rappels" class="panel-collapse panel-body collapse">
@ -465,7 +465,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel panel-default" id="social"> <div class="panel panel-default" id="social">
<div class="panel-heading" data-toggle="collapse" href="#collapse_social"> <div class="panel-heading" data-toggle="collapse" href="#collapse_social">
<h4 class="panel-title"> <h4 class="panel-title">
<i class="fa fa-twitter"></i> {% trans "Social networks" %}</a> <a><i class="fa fa-twitter"></i> {% trans "Social networks" %}</a>
</h4> </h4>
</div> </div>
<div id="collapse_social" class="panel-collapse panel-body collapse"> <div id="collapse_social" class="panel-collapse panel-body collapse">

View file

@ -191,7 +191,7 @@ def add_service(request):
messages.success(request, _("The service was added.")) messages.success(request, _("The service was added."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"preferenceform": service, "action_name": _("Add a service")}, {"preferenceform": service, "action_name": _("Add")},
"preferences/preferences.html", "preferences/preferences.html",
request, request,
) )
@ -224,7 +224,7 @@ def del_service(request, service_instance, **_kwargs):
messages.success(request, _("The service was deleted.")) messages.success(request, _("The service was deleted."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"objet": service_instance, "objet_name": "service"}, {"objet": service_instance, "objet_name": _("service")},
"preferences/delete.html", "preferences/delete.html",
request, request,
) )
@ -240,7 +240,7 @@ def add_reminder(request):
messages.success(request, _("The reminder was added.")) messages.success(request, _("The reminder was added."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"preferenceform": reminder, "action_name": _("Add a reminder")}, {"preferenceform": reminder, "action_name": _("Add")},
"preferences/preferences.html", "preferences/preferences.html",
request, request,
) )
@ -273,7 +273,7 @@ def del_reminder(request, reminder_instance, **_kwargs):
messages.success(request, _("The reminder was deleted.")) messages.success(request, _("The reminder was deleted."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"objet": reminder_instance, "objet_name": "reminder"}, {"objet": reminder_instance, "objet_name": _("reminder")},
"preferences/delete.html", "preferences/delete.html",
request, request,
) )
@ -289,7 +289,7 @@ def add_radiuskey(request):
messages.success(request, _("The RADIUS key was added.")) messages.success(request, _("The RADIUS key was added."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"preferenceform": radiuskey, "action_name": _("Add a RADIUS key")}, {"preferenceform": radiuskey, "action_name": _("Add")},
"preferences/preferences.html", "preferences/preferences.html",
request, request,
) )
@ -328,7 +328,7 @@ def del_radiuskey(request, radiuskey_instance, **_kwargs):
) )
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"objet": radiuskey_instance, "objet_name": "radiuskey"}, {"objet": radiuskey_instance, "objet_name": _("RADIUS key")},
"preferences/delete.html", "preferences/delete.html",
request, request,
) )
@ -346,7 +346,7 @@ def add_switchmanagementcred(request):
return form( return form(
{ {
"preferenceform": switchmanagementcred, "preferenceform": switchmanagementcred,
"action_name": _("Add switch management credentials"), "action_name": _("Add"),
}, },
"preferences/preferences.html", "preferences/preferences.html",
request, request,
@ -391,7 +391,7 @@ def del_switchmanagementcred(request, switchmanagementcred_instance, **_kwargs):
) )
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"objet": switchmanagementcred_instance, "objet_name": "switchmanagementcred"}, {"objet": switchmanagementcred_instance, "objet_name": _("switch management credentials")},
"preferences/delete.html", "preferences/delete.html",
request, request,
) )
@ -409,7 +409,7 @@ def add_mailcontact(request):
return form( return form(
{ {
"preferenceform": mailcontact, "preferenceform": mailcontact,
"action_name": _("Add a contact email address"), "action_name": _("Add"),
}, },
"preferences/preferences.html", "preferences/preferences.html",
request, request,
@ -524,8 +524,8 @@ def del_document_template(request, instances):
messages.error( messages.error(
request, request,
_( _(
"The document template %(document_template)s can't be deleted \ "The document template %(document_template)s can't be"
because it is currently being used." " deleted because it is currently being used."
) )
% {"document_template": document_template}, % {"document_template": document_template},
) )
@ -551,7 +551,7 @@ def add_radiusattribute(request):
messages.success(request, _("The attribute was added.")) messages.success(request, _("The attribute was added."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"preferenceform": attribute, "action_name": _("Add a RADIUS attribute")}, {"preferenceform": attribute, "action_name": _("Add")},
"preferences/preferences.html", "preferences/preferences.html",
request, request,
) )
@ -584,7 +584,7 @@ def del_radiusattribute(request, radiusattribute_instance, **_kwargs):
messages.success(request, _("The attribute was deleted.")) messages.success(request, _("The attribute was deleted."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"objet": radiusattribute_instance, "objet_name": "attribute"}, {"objet": radiusattribute_instance, "objet_name": _("attribute")},
"preferences/delete.html", "preferences/delete.html",
request, request,
) )
@ -600,7 +600,7 @@ def add_mandate(request):
messages.success(request, _("The mandate was added.")) messages.success(request, _("The mandate was added."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"preferenceform": mandate, "action_name": _("Add a mandate")}, {"preferenceform": mandate, "action_name": _("Add")},
"preferences/preferences.html", "preferences/preferences.html",
request, request,
) )
@ -631,7 +631,7 @@ def del_mandate(request, mandate_instance, **_kwargs):
messages.success(request, _("The mandate was deleted.")) messages.success(request, _("The mandate was deleted."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
return form( return form(
{"objet": mandate_instance, "objet_name": "attribute"}, {"objet": mandate_instance, "objet_name": _("mandate")},
"preferences/delete.html", "preferences/delete.html",
request, request,
) )