From b1a297d33778ac9abca68d5720c2322606266ca4 Mon Sep 17 00:00:00 2001 From: Paul Schilling Date: Mon, 4 Dec 2023 10:13:06 +0100 Subject: [PATCH] [#1895] Make postcode field non-nullable --- .../migrations/0069_alter_user_postcode.py | 22 +++++++++++++++++++ src/open_inwoner/accounts/models.py | 4 ++-- .../templates/pages/profile/me.html | 4 ++-- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/open_inwoner/accounts/migrations/0069_alter_user_postcode.py diff --git a/src/open_inwoner/accounts/migrations/0069_alter_user_postcode.py b/src/open_inwoner/accounts/migrations/0069_alter_user_postcode.py new file mode 100644 index 0000000000..2249cd6b51 --- /dev/null +++ b/src/open_inwoner/accounts/migrations/0069_alter_user_postcode.py @@ -0,0 +1,22 @@ +# Generated by Django 3.2.20 on 2023-12-04 09:07 + +from django.db import migrations + +import localflavor.nl.models + + +class Migration(migrations.Migration): + + dependencies = [ + ("accounts", "0068_relax_email_constraint_for_eherkenning"), + ] + + operations = [ + migrations.AlterField( + model_name="user", + name="postcode", + field=localflavor.nl.models.NLZipCodeField( + blank=True, default="", max_length=7, verbose_name="Postcode" + ), + ), + ] diff --git a/src/open_inwoner/accounts/models.py b/src/open_inwoner/accounts/models.py index 2ea5d54f28..a7b146297e 100644 --- a/src/open_inwoner/accounts/models.py +++ b/src/open_inwoner/accounts/models.py @@ -151,7 +151,7 @@ class User(AbstractBaseUser, PermissionsMixin): verbose_name=_("House number"), default="", blank=True, max_length=250 ) postcode = NLZipCodeField( - verbose_name=_("Postcode"), null=True, blank=True, max_length=250 + verbose_name=_("Postcode"), blank=True, default="", max_length=250 ) city = models.CharField( verbose_name=_("City"), @@ -350,7 +350,7 @@ def get_age(self): def get_address(self): if self.street: - return f"{self.street} {self.housenumber}, {self.city}" + return f"{self.street} {self.housenumber}, {self.postcode} {self.city}" return "" def get_new_messages_total(self) -> int: diff --git a/src/open_inwoner/templates/pages/profile/me.html b/src/open_inwoner/templates/pages/profile/me.html index 71d791117d..0fcc9ad613 100644 --- a/src/open_inwoner/templates/pages/profile/me.html +++ b/src/open_inwoner/templates/pages/profile/me.html @@ -11,7 +11,7 @@

{% trans "Welkom" %}, {{ user.first_name }}

- {%trans "voor het laatst ingelogd op" %}: {{ user.last_login|date:"d-m-Y" }} om {{ user.last_login|date:"H:i" }} uur + {%trans "voor het laatst ingelogd op" %}: {{ user.last_login|date:"d F Y" }} om {{ user.last_login|date:"H:i" }} uur
{# Personal information #} @@ -38,7 +38,7 @@

{% trans "Persoonlijke gegevens" %}
{% trans "Geboortedatum" %}
-
{{ user.birthday|date:"d.m.Y" }}
+
{{ user.birthday|date:"d F Y" }}
{% trans "Adres" %}