Skip to content

Commit

Permalink
[#1895] Make postcode field non-nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-sigma committed Dec 4, 2023
1 parent bbc1a2a commit b1a297d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
22 changes: 22 additions & 0 deletions src/open_inwoner/accounts/migrations/0069_alter_user_postcode.py
Original file line number Diff line number Diff line change
@@ -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"
),
),
]
4 changes: 2 additions & 2 deletions src/open_inwoner/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/templates/pages/profile/me.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div class="tabled tabled--flexible">
<h1 class="h1 tabled__title">{% trans "Welkom" %}, {{ user.first_name }}</h1>
<span class="tabled__key">{%trans "voor het laatst ingelogd op" %}: <span class="tabled__value">{{ user.last_login|date:"d-m-Y" }} om {{ user.last_login|date:"H:i" }} uur</span></span>
<span class="tabled__key">{%trans "voor het laatst ingelogd op" %}: <span class="tabled__value">{{ user.last_login|date:"d F Y" }} om {{ user.last_login|date:"H:i" }} uur</span></span>
</div>

{# Personal information #}
Expand All @@ -38,7 +38,7 @@ <h2 class="h2 title" id="personal-overview">{% trans "Persoonlijke gegevens" %}
</div>
<div class="tabled__row tabled__row--blank">
<div class="tabled__item tabled__key">{% trans "Geboortedatum" %}</div>
<div class="tabled__item tabled__value">{{ user.birthday|date:"d.m.Y" }}</div>
<div class="tabled__item tabled__value">{{ user.birthday|date:"d F Y" }}</div>
</div>
<div class="tabled__row tabled__row--blank">
<div class="tabled__item tabled__key">{% trans "Adres" %}</div>
Expand Down

0 comments on commit b1a297d

Please sign in to comment.