From bb10b9cda6842186bbfe100e016f50c7cf868f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertu=C4=9Frul=20Keremo=C4=9Flu?= Date: Mon, 20 Oct 2025 01:51:13 +0300 Subject: [PATCH 01/57] Add `bio` field to `accounts.Profile` model --- accounts/forms.py | 5 ++++- accounts/migrations/0003_profile_bio.py | 18 +++++++++++++++++ accounts/models.py | 1 + djangoproject/scss/_style.scss | 20 ++++++++++++++++++- .../templates/accounts/edit_profile.html | 7 +++++++ .../templates/accounts/user_profile.html | 10 ++++++++-- 6 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 accounts/migrations/0003_profile_bio.py diff --git a/accounts/forms.py b/accounts/forms.py index f863c06787..eac1f5e1e6 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -20,10 +20,13 @@ class ProfileForm(forms.ModelForm): email = forms.EmailField( required=False, widget=forms.TextInput(attrs={"placeholder": _("Email")}) ) + bio = forms.CharField( + required=False, widget=forms.Textarea(attrs={"placeholder": _("Bio")}) + ) class Meta: model = Profile - fields = ["name"] + fields = ["name", "bio"] def __init__(self, *args, **kwargs): instance = kwargs.get("instance", None) diff --git a/accounts/migrations/0003_profile_bio.py b/accounts/migrations/0003_profile_bio.py new file mode 100644 index 0000000000..26b33e32cf --- /dev/null +++ b/accounts/migrations/0003_profile_bio.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-10-19 01:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0002_migrate_sha1_passwords'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='bio', + field=models.TextField(blank=True), + ), + ] diff --git a/accounts/models.py b/accounts/models.py index 5372b2caa3..63eb1013f8 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -5,6 +5,7 @@ class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) name = models.CharField(max_length=200, blank=True) + bio = models.TextField(blank=True) def __str__(self): return self.name or str(self.user) diff --git a/djangoproject/scss/_style.scss b/djangoproject/scss/_style.scss index 2fe7c0cfd1..4482f6e25d 100644 --- a/djangoproject/scss/_style.scss +++ b/djangoproject/scss/_style.scss @@ -3191,7 +3191,25 @@ hr { .user-info { .avatar { @include framed-image(); - float: right; + margin: 4rem 1rem 0rem 1rem; + + // The reason for specifying `355px` is to ensure that the image does not cause vertical space between the first name and last name on this screen size. + @include respond-min(355px) { + float: right; + margin: 0 0 1rem 1rem; + } + } + + .name { + margin-bottom: 0; + } + + .bio { + @include font-size(16); + font-weight: normal; + line-height: 1.5; + white-space: pre-line; + margin-top: 0; } } diff --git a/djangoproject/templates/accounts/edit_profile.html b/djangoproject/templates/accounts/edit_profile.html index 29d5dfc2d9..433b89d3be 100644 --- a/djangoproject/templates/accounts/edit_profile.html +++ b/djangoproject/templates/accounts/edit_profile.html @@ -27,6 +27,13 @@

{% translate "Edit your profile" %}

{{ form.email }}

+
+ {% if form.bio.errors %} +

{{ form.bio.errors.as_text }}

+ {% endif %} +

{{ form.bio }}

+
+
diff --git a/djangoproject/templates/accounts/user_profile.html b/djangoproject/templates/accounts/user_profile.html index 1c89ed9eab..40fd510744 100644 --- a/djangoproject/templates/accounts/user_profile.html +++ b/djangoproject/templates/accounts/user_profile.html @@ -15,7 +15,7 @@

{% translate "Need to edit something? Here's how:" %}