Skip to content

Commit

Permalink
Make user preferred_language not nullable with default of fi
Browse files Browse the repository at this point in the history
  • Loading branch information
matti-lamppu committed Nov 18, 2024
1 parent a40de0a commit 1c6fc45
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
22 changes: 22 additions & 0 deletions tilavarauspalvelu/migrations/0031_alter_user_preferred_language.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.1.1 on 2024-10-03 11:47

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("tilavarauspalvelu", "0030_determine_preferred_language"),
]

operations = [
migrations.AlterField(
model_name="user",
name="preferred_language",
field=models.CharField(
blank=True,
choices=[("fi", "Finnish"), ("en", "English"), ("sv", "Swedish")],
default="fi",
max_length=8,
),
),
]
7 changes: 6 additions & 1 deletion tilavarauspalvelu/models/user/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@

class User(AbstractUser):
tvp_uuid: uuid.UUID = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
preferred_language: str | None = models.CharField(max_length=8, null=True, blank=True, choices=settings.LANGUAGES)
preferred_language: str = models.CharField(
max_length=8,
blank=True,
choices=settings.LANGUAGES,
default=settings.LANGUAGE_CODE,
)
date_of_birth: datetime.date | None = models.DateField(null=True, blank=True)
profile_id: str = models.CharField(max_length=255, blank=True, default="")

Expand Down

0 comments on commit 1c6fc45

Please sign in to comment.