Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1895] Make postcode field non-nullable #874

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading