Add pronouns to profile ; Update gender settings

Add pronouns to option list in profile
Modify "Sex" translation to "Genre"
Added "Other" to sex option list (alongside Man and Woman)

update DB,add default value to Pronouns field

Update views.py
This commit is contained in:
Céleste 2021-09-30 18:17:22 +02:00 committed by Celeste
parent 26a07f722d
commit 1f7752d457
5 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,24 @@
# Generated by Django 2.2.24 on 2021-10-01 00:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0035_auto_20200216_1743'),
]
operations = [
migrations.AddField(
model_name='user',
name='pronouns',
field=models.CharField(default='', max_length=64, verbose_name='pronouns'),
preserve_default=False,
),
migrations.AlterField(
model_name='user',
name='sex',
field=models.CharField(blank=True, choices=[('MAN', 'Man'), ('WOMAN', 'Woman'), ('OTHER', 'Other')], max_length=10, null=True, verbose_name='sex'),
),
]

View File

@ -227,8 +227,9 @@ class User(AbstractBaseUser):
max_length=10, max_length=10,
null=True, null=True,
blank=True, blank=True,
choices=[("MAN", _("Man")), ("WOMAN", _("Woman"))], choices=[("MAN", _("Man")), ("WOMAN", _("Woman")), ("OTHER", _("Other"))],
) )
pronouns = models.CharField(_("pronouns"), max_length=64, default='')
tshirt_size = models.CharField( tshirt_size = models.CharField(
_("tshirt size"), _("tshirt size"),
max_length=5, max_length=5,

View File

@ -222,6 +222,7 @@ class UserProfileForm(forms.ModelForm):
"avatar_pict", "avatar_pict",
"scrub_pict", "scrub_pict",
"sex", "sex",
"pronouns",
"second_email", "second_email",
"address", "address",
"parent_address", "parent_address",

View File

@ -2061,7 +2061,7 @@ msgstr "blouse"
#: core/models.py:203 #: core/models.py:203
msgid "sex" msgid "sex"
msgstr "sexe" msgstr "Genre"
#: core/models.py:205 matmat/views.py:74 #: core/models.py:205 matmat/views.py:74
msgid "Man" msgid "Man"
@ -2071,6 +2071,10 @@ msgstr "Homme"
msgid "Woman" msgid "Woman"
msgstr "Femme" msgstr "Femme"
#:core/models.py:232
msgid "Pronouns"
msgstr "Pronoms"
#: core/models.py:209 #: core/models.py:209
msgid "tshirt size" msgid "tshirt size"
msgstr "taille de tshirt" msgstr "taille de tshirt"

View File

@ -44,6 +44,7 @@ def merge_users(u1, u2):
u1.date_of_birth = u1.date_of_birth or u2.date_of_birth u1.date_of_birth = u1.date_of_birth or u2.date_of_birth
u1.home = u1.home or u2.home u1.home = u1.home or u2.home
u1.sex = u1.sex or u2.sex u1.sex = u1.sex or u2.sex
u1.pronouns = u1.pronouns or u2.pronouns
u1.tshirt_size = u1.tshirt_size or u2.tshirt_size u1.tshirt_size = u1.tshirt_size or u2.tshirt_size
u1.role = u1.role or u2.role u1.role = u1.role or u2.role
u1.department = u1.department or u2.department u1.department = u1.department or u2.department