Translation fixes in bds.models

- the 'u' in ugettext_lazy in a legacy of python2, we can drop it now
- translate all verbose names
- start field verbose names with a lowercase letter
This commit is contained in:
Martin Pépin 2019-10-06 19:03:19 +02:00
parent f9aee86a1c
commit 98fe68d0be
No known key found for this signature in database
GPG key ID: E7520278B1774448
2 changed files with 29 additions and 27 deletions

View file

@ -29,7 +29,7 @@ class Migration(migrations.Migration):
( (
"phone", "phone",
models.CharField( models.CharField(
blank=True, max_length=20, verbose_name="Téléphone" blank=True, max_length=20, verbose_name="téléphone"
), ),
), ),
( (
@ -49,37 +49,37 @@ class Migration(migrations.Migration):
], ],
default="1A", default="1A",
max_length=3, max_length=3,
verbose_name="Occupation", verbose_name="occupation",
), ),
), ),
( (
"departement", "departement",
models.CharField( models.CharField(
blank=True, max_length=50, verbose_name="Département" blank=True, max_length=50, verbose_name="département"
), ),
), ),
( (
"birthdate", "birthdate",
models.DateField( models.DateField(
blank=True, null=True, verbose_name="Date de naissance" blank=True, null=True, verbose_name="date de naissance"
), ),
), ),
( (
"mails_bds", "mails_bds",
models.BooleanField( models.BooleanField(
default=False, verbose_name="Recevoir les mails du BDS" default=False, verbose_name="recevoir les mails du BDS"
), ),
), ),
( (
"is_buro", "is_buro",
models.BooleanField( models.BooleanField(
default=False, verbose_name="Membre du Burô du BDS" default=False, verbose_name="membre du Burô du BDS"
), ),
), ),
( (
"has_certificate", "has_certificate",
models.BooleanField( models.BooleanField(
default=False, verbose_name="Certificat médical" default=False, verbose_name="certificat médical"
), ),
), ),
( (
@ -87,7 +87,7 @@ class Migration(migrations.Migration):
models.FileField( models.FileField(
blank=True, blank=True,
upload_to=bds.models.BDSProfile.get_certificate_filename, upload_to=bds.models.BDSProfile.get_certificate_filename,
verbose_name="Fichier de certificat médical", verbose_name="fichier de certificat médical",
), ),
), ),
( (
@ -96,13 +96,13 @@ class Migration(migrations.Migration):
blank=True, blank=True,
max_length=50, max_length=50,
null=True, null=True,
verbose_name="Numéro AS PSL", verbose_name="numéro AS PSL",
), ),
), ),
( (
"FFSU_number", "FFSU_number",
models.CharField( models.CharField(
blank=True, max_length=50, null=True, verbose_name="Numéro FFSU" blank=True, max_length=50, null=True, verbose_name="numéro FFSU"
), ),
), ),
( (
@ -116,13 +116,13 @@ class Migration(migrations.Migration):
], ],
default="NO", default="NO",
max_length=3, max_length=3,
verbose_name="Inscription", verbose_name="inscription",
), ),
), ),
( (
"registration_date", "registration_date",
models.DateField( models.DateField(
auto_now_add=True, verbose_name="Date d'inscription" auto_now_add=True, verbose_name="date d'inscription"
), ),
), ),
( (

View file

@ -3,7 +3,7 @@ from os.path import splitext
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from shared.utils import choices_length from shared.utils import choices_length
@ -46,48 +46,50 @@ class BDSProfile(models.Model):
) )
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="bds") user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="bds")
phone = models.CharField(_("Téléphone"), max_length=20, blank=True) phone = models.CharField(_("téléphone"), max_length=20, blank=True)
occupation = models.CharField( occupation = models.CharField(
_("Occupation"), _("occupation"),
default="1A", default="1A",
choices=OCCUPATION_CHOICES, choices=OCCUPATION_CHOICES,
max_length=choices_length(OCCUPATION_CHOICES), max_length=choices_length(OCCUPATION_CHOICES),
) )
departement = models.CharField(_("Département"), max_length=50, blank=True) departement = models.CharField(_("département"), max_length=50, blank=True)
birthdate = models.DateField( birthdate = models.DateField(
auto_now_add=False, auto_now_add=False,
auto_now=False, auto_now=False,
verbose_name="Date de naissance", verbose_name=_("date de naissance"),
blank=True, blank=True,
null=True, null=True,
) )
mails_bds = models.BooleanField(_("Recevoir les mails du BDS"), default=False) mails_bds = models.BooleanField(_("recevoir les mails du BDS"), default=False)
is_buro = models.BooleanField(_("Membre du Burô du BDS"), default=False) is_buro = models.BooleanField(_("membre du Burô du BDS"), default=False)
has_certificate = models.BooleanField(_("Certificat médical"), default=False) has_certificate = models.BooleanField(_("certificat médical"), default=False)
certificate_file = models.FileField( certificate_file = models.FileField(
_("Fichier de certificat médical"), _("fichier de certificat médical"),
upload_to=get_certificate_filename, upload_to=get_certificate_filename,
blank=True, blank=True,
) )
ASPSL_number = models.CharField( ASPSL_number = models.CharField(
"Numéro AS PSL", max_length=50, blank=True, null=True _("numéro AS PSL"), max_length=50, blank=True, null=True
)
FFSU_number = models.CharField(
_("numéro FFSU"), max_length=50, blank=True, null=True
) )
FFSU_number = models.CharField("Numéro FFSU", max_length=50, blank=True, null=True)
cotisation_period = models.CharField( cotisation_period = models.CharField(
"Inscription", default="NO", choices=COTIZ_DURATION_CHOICES, max_length=3 _("inscription"), default="NO", choices=COTIZ_DURATION_CHOICES, max_length=3
) )
registration_date = models.DateField( registration_date = models.DateField(
auto_now_add=True, verbose_name="Date d'inscription" auto_now_add=True, verbose_name=_("date d'inscription")
) )
class Meta: class Meta:
verbose_name = "Profil BDS" verbose_name = _("Profil BDS")
verbose_name_plural = "Profils BDS" verbose_name_plural = _("Profils BDS")
def __str__(self): def __str__(self):
return self.user.username return self.user.username