From 4fbee9c3de0ac595883a32a219e05c6d47f23756 Mon Sep 17 00:00:00 2001 From: Celeste Date: Wed, 13 Oct 2021 08:59:40 +0200 Subject: [PATCH] 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 %} -