From 26a07f722d3ddc83bde31f6a746ca96f255d0bab Mon Sep 17 00:00:00 2001 From: CHARMEAU Date: Sun, 16 Feb 2020 17:51:51 +0100 Subject: [PATCH 1/7] Remove gender option of matmatronche & update gender settings --- core/migrations/0035_auto_20200216_1743.py | 24 ++++++++++++++++++++++ core/models.py | 3 ++- matmat/templates/matmat/search_form.jinja | 2 -- matmat/views.py | 13 +----------- 4 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 core/migrations/0035_auto_20200216_1743.py diff --git a/core/migrations/0035_auto_20200216_1743.py b/core/migrations/0035_auto_20200216_1743.py new file mode 100644 index 00000000..07545832 --- /dev/null +++ b/core/migrations/0035_auto_20200216_1743.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.10 on 2020-02-16 16:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0034_operationlog"), + ] + + operations = [ + migrations.AlterField( + model_name="user", + name="sex", + field=models.CharField( + blank=True, + choices=[("MAN", "Man"), ("WOMAN", "Woman")], + max_length=10, + null=True, + verbose_name="sex", + ), + ), + ] diff --git a/core/models.py b/core/models.py index d0db1a94..7351c1ce 100644 --- a/core/models.py +++ b/core/models.py @@ -225,8 +225,9 @@ class User(AbstractBaseUser): sex = models.CharField( _("sex"), max_length=10, + null=True, + blank=True, choices=[("MAN", _("Man")), ("WOMAN", _("Woman"))], - default="MAN", ) tshirt_size = models.CharField( _("tshirt size"), diff --git a/matmat/templates/matmat/search_form.jinja b/matmat/templates/matmat/search_form.jinja index 34d1c1a3..9a2eb149 100644 --- a/matmat/templates/matmat/search_form.jinja +++ b/matmat/templates/matmat/search_form.jinja @@ -43,7 +43,6 @@ {{ form.phone.errors }} {{ form.phone }} - {{ form.sex.as_hidden() }}

@@ -53,7 +52,6 @@

{{ form.quick.errors }} - {{ form.sex.as_hidden() }} {{ form.quick }}

diff --git a/matmat/views.py b/matmat/views.py index 112c1d54..a2d8fff9 100644 --- a/matmat/views.py +++ b/matmat/views.py @@ -69,17 +69,6 @@ class SearchForm(forms.ModelForm): "phone": PhoneNumberInternationalFallbackWidget, } - sex = forms.ChoiceField( - choices=[ - ("MAN", _("Man")), - ("WOMAN", _("Woman")), - ("INDIFFERENT", _("Indifferent")), - ], - widget=forms.RadioSelect, - initial="INDIFFERENT", - label=_("Sex"), - ) - quick = forms.CharField(label=_("Last/First name or nickname"), max_length=255) def __init__(self, *args, **kwargs): @@ -150,7 +139,7 @@ class SearchFormListView(FormerSubscriberMixin, SingleObjectMixin, ListView): search_dict = {} for key, value in self.valid_form.items(): if key not in ("phone", "quick") and not ( - value == "" or value is None or value == "INDIFFERENT" + value == "" or value is None ): search_dict[key + "__icontains"] = value q = q.filter(**search_dict).all() From 1f7752d45798ce09da716c8113ee13bab0b8b1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9leste?= Date: Thu, 30 Sep 2021 18:17:22 +0200 Subject: [PATCH 2/7] 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 --- core/migrations/0036_auto_20211001_0248.py | 24 ++++++++++++++++++++++ core/models.py | 3 ++- core/views/forms.py | 1 + locale/fr/LC_MESSAGES/django.po | 6 +++++- rootplace/views.py | 1 + 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 core/migrations/0036_auto_20211001_0248.py diff --git a/core/migrations/0036_auto_20211001_0248.py b/core/migrations/0036_auto_20211001_0248.py new file mode 100644 index 00000000..42d4f109 --- /dev/null +++ b/core/migrations/0036_auto_20211001_0248.py @@ -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'), + ), + ] diff --git a/core/models.py b/core/models.py index 7351c1ce..b9f0f243 100644 --- a/core/models.py +++ b/core/models.py @@ -227,8 +227,9 @@ class User(AbstractBaseUser): max_length=10, null=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"), max_length=5, diff --git a/core/views/forms.py b/core/views/forms.py index 1cfa42d9..712d3be6 100644 --- a/core/views/forms.py +++ b/core/views/forms.py @@ -222,6 +222,7 @@ class UserProfileForm(forms.ModelForm): "avatar_pict", "scrub_pict", "sex", + "pronouns", "second_email", "address", "parent_address", diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 4f3a6080..2b00bab8 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -2061,7 +2061,7 @@ msgstr "blouse" #: core/models.py:203 msgid "sex" -msgstr "sexe" +msgstr "Genre" #: core/models.py:205 matmat/views.py:74 msgid "Man" @@ -2071,6 +2071,10 @@ msgstr "Homme" msgid "Woman" msgstr "Femme" +#:core/models.py:232 +msgid "Pronouns" +msgstr "Pronoms" + #: core/models.py:209 msgid "tshirt size" msgstr "taille de tshirt" diff --git a/rootplace/views.py b/rootplace/views.py index 570cae7b..460250cb 100644 --- a/rootplace/views.py +++ b/rootplace/views.py @@ -44,6 +44,7 @@ def merge_users(u1, u2): u1.date_of_birth = u1.date_of_birth or u2.date_of_birth u1.home = u1.home or u2.home 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.role = u1.role or u2.role u1.department = u1.department or u2.department From 4fbee9c3de0ac595883a32a219e05c6d47f23756 Mon Sep 17 00:00:00 2001 From: Celeste Date: Wed, 13 Oct 2021 08:59:40 +0200 Subject: [PATCH 3/7] Make pronouns visible on profile and miniprofile --- core/migrations/0036_auto_20211001_0248.py | 22 +++++++++++++--------- core/models.py | 6 ++---- core/templates/core/macros.jinja | 5 ++++- core/templates/core/user_detail.jinja | 9 ++++++++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/core/migrations/0036_auto_20211001_0248.py b/core/migrations/0036_auto_20211001_0248.py index 42d4f109..428bdb9e 100644 --- a/core/migrations/0036_auto_20211001_0248.py +++ b/core/migrations/0036_auto_20211001_0248.py @@ -5,20 +5,24 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('core', '0035_auto_20200216_1743'), - ] + dependencies = [("core", "0035_auto_20200216_1743")] operations = [ migrations.AddField( - model_name='user', - name='pronouns', - field=models.CharField(default='', max_length=64, verbose_name='pronouns'), + 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'), + 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", + ), ), ] diff --git a/core/models.py b/core/models.py index 22bfc1d1..46aa163a 100644 --- a/core/models.py +++ b/core/models.py @@ -229,7 +229,7 @@ class User(AbstractBaseUser): blank=True, choices=[("MAN", _("Man")), ("WOMAN", _("Woman")), ("OTHER", _("Other"))], ) - pronouns = models.CharField(_("pronouns"), max_length=64, default='') + pronouns = models.CharField(_("pronouns"), max_length=64, default="") tshirt_size = models.CharField( _("tshirt size"), max_length=5, @@ -1492,9 +1492,7 @@ class OperationLog(models.Model): User, related_name="logs", on_delete=models.SET_NULL, null=True ) operation_type = models.CharField( - _("operation type"), - max_length=40, - choices=settings.SITH_LOG_OPERATION_TYPE, + _("operation type"), max_length=40, choices=settings.SITH_LOG_OPERATION_TYPE ) def is_owned_by(self, user): diff --git a/core/templates/core/macros.jinja b/core/templates/core/macros.jinja index 965c6f11..02a3ceae 100644 --- a/core/templates/core/macros.jinja +++ b/core/templates/core/macros.jinja @@ -55,6 +55,9 @@ {% if user.nick_name %}
« {{ user.nick_name }} »
{% endif %} + {% if user.pronouns %} +
{{ user.pronouns }}
+ {% endif %} {% if user.date_of_birth %}
{{ user.date_of_birth|date("d/m/Y") }} ({{ user.get_age() }}) @@ -149,4 +152,4 @@ -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/core/templates/core/user_detail.jinja b/core/templates/core/user_detail.jinja index bad9854f..a86106c7 100644 --- a/core/templates/core/user_detail.jinja +++ b/core/templates/core/user_detail.jinja @@ -15,6 +15,8 @@
« {{ profile.nick_name }} »
{% endif %} + + {% if profile.quote %}
{{ profile.quote }} @@ -22,6 +24,12 @@ {% endif %}
+ {% if profile.pronouns %} +
+ + +
+ {% endif %} {% if profile.date_of_birth %}
@@ -230,4 +238,3 @@ $(function(){ }); {% endblock %} - From b8aabc466c74ff317a134408597c2d15800a85fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ail=C3=A9?= <03ht@theodurr.fr> Date: Fri, 5 Nov 2021 20:28:37 +0100 Subject: [PATCH 4/7] Fixed locales +Pronoun description on the user's profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ailé <03ht@theodurr.fr> --- core/migrations/0037_auto_20211105_1708.py | 18 ++++++++++++++++++ core/templates/core/user_detail.jinja | 2 +- locale/fr/LC_MESSAGES/django.po | 8 ++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 core/migrations/0037_auto_20211105_1708.py diff --git a/core/migrations/0037_auto_20211105_1708.py b/core/migrations/0037_auto_20211105_1708.py new file mode 100644 index 00000000..94c61fd7 --- /dev/null +++ b/core/migrations/0037_auto_20211105_1708.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.24 on 2021-11-05 16:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0036_auto_20211001_0248'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='pronouns', + field=models.CharField(default='', max_length=64, verbose_name='pronouns'), + ), + ] diff --git a/core/templates/core/user_detail.jinja b/core/templates/core/user_detail.jinja index a86106c7..b3159303 100644 --- a/core/templates/core/user_detail.jinja +++ b/core/templates/core/user_detail.jinja @@ -26,7 +26,7 @@
{% if profile.pronouns %}
- +
{% endif %} diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 33fca100..c6a59463 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -2071,8 +2071,8 @@ msgid "Woman" msgstr "Femme" #:core/models.py:232 -msgid "Pronouns" -msgstr "Pronoms" +msgid "pronouns" +msgstr "pronoms" #: core/models.py:209 msgid "tshirt size" @@ -3112,6 +3112,10 @@ msgstr "Profil de %(user_name)s" msgid "Born: " msgstr "Né le : " +#: core/templates/core/user_detail.jinja:27 +msgid "Pronouns: " +msgstr "Pronoms : " + #: core/templates/core/user_detail.jinja:34 msgid "Department: " msgstr "Département : " From 6390c3320eecc11c0a31ae79cabef66ab917bdc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ail=C3=A9?= <03ht@theodurr.fr> Date: Fri, 5 Nov 2021 20:40:20 +0100 Subject: [PATCH 5/7] Applied black on migration --- core/migrations/0037_auto_20211105_1708.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/migrations/0037_auto_20211105_1708.py b/core/migrations/0037_auto_20211105_1708.py index 94c61fd7..0a1299bd 100644 --- a/core/migrations/0037_auto_20211105_1708.py +++ b/core/migrations/0037_auto_20211105_1708.py @@ -6,13 +6,13 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('core', '0036_auto_20211001_0248'), + ("core", "0036_auto_20211001_0248"), ] operations = [ migrations.AlterField( - model_name='user', - name='pronouns', - field=models.CharField(default='', max_length=64, verbose_name='pronouns'), + model_name="user", + name="pronouns", + field=models.CharField(default="", max_length=64, verbose_name="pronouns"), ), ] From 707459acd6a36e4656ae79d3502127901f8fd80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ail=C3=A9?= <03ht@theodurr.fr> Date: Fri, 5 Nov 2021 21:01:19 +0100 Subject: [PATCH 6/7] Changed word 'Godfather' to 'Family' --- core/views/user.py | 4 ++-- locale/fr/LC_MESSAGES/django.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/views/user.py b/core/views/user.py index f613d6d5..aea3de60 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -202,7 +202,7 @@ class UserTabsMixin(TabedViewMixin): "core:user_godfathers", kwargs={"user_id": self.object.id} ), "slug": "godfathers", - "name": _("Godfathers"), + "name": _("Family"), } ) tab_list.append( @@ -474,7 +474,7 @@ class UserGodfathersTreePictureView(CanViewMixin, DetailView): if self.param == "godchildren": self.graph.graph_attr["label"] = _("Godchildren") elif self.param == "godfathers": - self.graph.graph_attr["label"] = _("Godfathers") + self.graph.graph_attr["label"] = _("Family") else: self.graph.graph_attr["label"] = _("Family") img = self.graph.draw(format="png", prog="dot") diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index c6a59463..365f8995 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -3244,8 +3244,8 @@ msgstr "Voir une image de la famille" #: core/templates/core/user_godfathers.jinja:12 core/views/user.py:205 #: core/views/user.py:477 -msgid "Godfathers" -msgstr "Parrains" +msgid "Family" +msgstr "Famille" #: core/templates/core/user_godfathers.jinja:20 msgid "Show ancestors tree" From c6a3677cc50f0a765449a08e8e8fa89d4f2cf021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ail=C3=A9?= <03ht@theodurr.fr> Date: Fri, 5 Nov 2021 21:11:52 +0100 Subject: [PATCH 7/7] Fixed duplicated translation --- locale/fr/LC_MESSAGES/django.po | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 365f8995..539e5906 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -3243,7 +3243,7 @@ msgid "Show family picture" msgstr "Voir une image de la famille" #: core/templates/core/user_godfathers.jinja:12 core/views/user.py:205 -#: core/views/user.py:477 +#: core/views/user.py:477 core/views/user.py:479 msgid "Family" msgstr "Famille" @@ -3693,10 +3693,6 @@ msgstr "Utilisateurs à ajouter au groupe" msgid "Pictures" msgstr "Photos" -#: core/views/user.py:479 -msgid "Family" -msgstr "Famille" - #: core/views/user.py:621 msgid "User already has a profile picture" msgstr "L'utilisateur a déjà une photo de profil"