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

[#2035] Remove user birthday field #979

Merged
merged 1 commit into from
Jan 29, 2024
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
1 change: 0 additions & 1 deletion src/open_inwoner/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class Meta:
"display_name",
"email",
"phonenumber",
"birthday",
"street",
"housenumber",
"postcode",
Expand Down
17 changes: 17 additions & 0 deletions src/open_inwoner/accounts/migrations/0071_remove_user_birthday.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.23 on 2024-01-22 15:22

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("accounts", "0070_auto_20231205_1657"),
]

operations = [
migrations.RemoveField(
model_name="user",
name="birthday",
),
]
13 changes: 13 additions & 0 deletions src/open_inwoner/accounts/migrations/0072_merge_20240129_1610.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 3.2.23 on 2024-01-29 15:10

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("accounts", "0071_delete_appointment"),
("accounts", "0071_remove_user_birthday"),
]

operations = []
13 changes: 0 additions & 13 deletions src/open_inwoner/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ class User(AbstractBaseUser, PermissionsMixin):
default=LoginTypeChoices.default,
max_length=250,
)
birthday = models.DateField(verbose_name=_("Birthday"), null=True, blank=True)
street = models.CharField(
verbose_name=_("Street"),
default="",
Expand Down Expand Up @@ -340,18 +339,6 @@ def get_full_name(self):
def get_short_name(self):
return self.first_name

def get_age(self):
if self.birthday:
today = date.today()
age = (
today.year
- self.birthday.year
- ((today.month, today.day) < (self.birthday.month, self.birthday.day))
)

return age
return None

def get_address(self):
if self.street:
return f"{self.street} {self.housenumber}, {self.postcode} {self.city}"
Expand Down
1 change: 0 additions & 1 deletion src/open_inwoner/accounts/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ def test_first_digid_login_updates_brp_fields(self, m):

self.assertEqual(user.first_name, "Merel")
self.assertEqual(user.last_name, "Kooyman")
self.assertEqual(user.birthday, date(1982, 4, 10))
self.assertEqual(user.street, "King Olivereiland")
self.assertEqual(user.housenumber, "64")
self.assertEqual(user.city, "'s-Gravenhage")
Expand Down
3 changes: 0 additions & 3 deletions src/open_inwoner/accounts/tests/test_profile_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ def test_save_empty_form_fails(self):
form["display_name"] = ""
form["email"] = ""
form["phonenumber"] = ""
form["birthday"] = ""
form["street"] = ""
form["housenumber"] = ""
form["postcode"] = ""
Expand All @@ -337,7 +336,6 @@ def test_save_filled_form(self):
form["display_name"] = "a nickname"
form["email"] = "[email protected]"
form["phonenumber"] = "0612345678"
form["birthday"] = "21-01-1992"
form["street"] = "Keizersgracht"
form["housenumber"] = "17 d"
form["postcode"] = "1013 RM"
Expand All @@ -351,7 +349,6 @@ def test_save_filled_form(self):
self.assertEquals(self.user.last_name, "Last name")
self.assertEquals(self.user.display_name, "a nickname")
self.assertEquals(self.user.email, "[email protected]")
self.assertEquals(self.user.birthday.strftime("%d-%m-%Y"), "21-01-1992")
self.assertEquals(self.user.street, "Keizersgracht")
self.assertEquals(self.user.housenumber, "17 d")
self.assertEquals(self.user.postcode, "1013 RM")
Expand Down
24 changes: 0 additions & 24 deletions src/open_inwoner/accounts/tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,6 @@ def test_get_full_name(self):
)
self.assertEqual(user.get_full_name(), "")

@freeze_time("2021-07-07 12:00:00")
def test_get_age_same_day(self):
with freeze_time("1990-07-07"):
user = User(birthday=date.today())
self.assertEqual(user.get_age(), 31)

@freeze_time("2021-07-07 12:00:00")
def test_get_age_day_before(self):
with freeze_time("1990-07-08"):
user = User(birthday=date.today())
self.assertEqual(user.get_age(), 30)

@freeze_time("2021-07-07 12:00:00")
def test_get_age_day_after(self):
with freeze_time("1990-07-06"):
user = User(birthday=date.today())
self.assertEqual(user.get_age(), 31)

@freeze_time("2021-07-07 12:00:00")
def test_get_age_young(self):
with freeze_time("2014-01-07"):
user = User(birthday=date.today())
self.assertEqual(user.get_age(), 7)

def test_require_necessary_fields(self):
user = UserFactory()
self.assertFalse(user.require_necessary_fields())
Expand Down
5 changes: 0 additions & 5 deletions src/open_inwoner/conf/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,6 @@ msgstr "Bedrijfsnaam"
msgid "Login type"
msgstr "Logintype"

#: src/open_inwoner/accounts/models.py:148
#: src/open_inwoner/templates/export/profile/profile_export.html:14
msgid "Birthday"
msgstr "Geboortedatum"

#: src/open_inwoner/accounts/models.py:150
msgid "Street"
msgstr "Straat"
Expand Down
8 changes: 0 additions & 8 deletions src/open_inwoner/haalcentraal/tests/test_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def test_signal_updates_users_data_when_logged_in_via_digid_v_2(self, m):
self.assertEqual(user.first_name, "Merel")
self.assertEqual(user.infix, "de")
self.assertEqual(user.last_name, "Kooyman")
self.assertEqual(user.birthday, date(1982, 4, 10))
self.assertEqual(user.street, "King Olivereiland")
self.assertEqual(user.housenumber, "64")
self.assertEqual(user.city, "'s-Gravenhage")
Expand All @@ -57,7 +56,6 @@ def test_signal_updates_users_data_when_logged_in_via_digid_v_1_3(self, m):
self.assertEqual(user.first_name, "Merel")
self.assertEqual(user.infix, "de")
self.assertEqual(user.last_name, "Kooyman")
self.assertEqual(user.birthday, date(1982, 4, 10))
self.assertEqual(user.street, "King Olivereiland")
self.assertEqual(user.housenumber, "64")
self.assertEqual(user.city, "'s-Gravenhage")
Expand Down Expand Up @@ -98,7 +96,6 @@ def test_user_is_not_updated_without_defining_service(self, m):
self.assertEqual(user.first_name, "")
self.assertEqual(user.infix, "")
self.assertEqual(user.last_name, "")
self.assertEqual(user.birthday, None)
self.assertEqual(user.street, "")
self.assertEqual(user.housenumber, "")
self.assertEqual(user.city, "")
Expand All @@ -118,7 +115,6 @@ def test_user_is_not_updated_when_not_logged_in_via_digid(self, m):
self.assertEqual(user.first_name, "")
self.assertEqual(user.infix, "")
self.assertEqual(user.last_name, "")
self.assertEqual(user.birthday, None)
self.assertEqual(user.street, "")
self.assertEqual(user.housenumber, "")
self.assertEqual(user.city, "")
Expand Down Expand Up @@ -148,7 +144,6 @@ def test_empty_response_from_haalcentraal(self, m):
self.assertEqual(user.first_name, "")
self.assertEqual(user.infix, "")
self.assertEqual(user.last_name, "")
self.assertEqual(user.birthday, None)
self.assertEqual(user.street, "")
self.assertEqual(user.housenumber, "")
self.assertEqual(user.city, "")
Expand Down Expand Up @@ -190,7 +185,6 @@ def test_wrong_date_format_saves_birthday_none_brp_v_1_3(self, m):
self.assertEqual(user.first_name, "")
self.assertEqual(user.infix, "")
self.assertEqual(user.last_name, "")
self.assertEqual(user.birthday, None)
self.assertEqual(user.street, "")
self.assertEqual(user.housenumber, "")
self.assertEqual(user.city, "")
Expand Down Expand Up @@ -220,7 +214,6 @@ def test_user_is_not_updated_when_http_404(self, m):
self.assertEqual(user.first_name, "")
self.assertEqual(user.infix, "")
self.assertEqual(user.last_name, "")
self.assertEqual(user.birthday, None)
self.assertEqual(user.street, "")
self.assertEqual(user.housenumber, "")
self.assertEqual(user.city, "")
Expand Down Expand Up @@ -250,7 +243,6 @@ def test_user_is_not_updated_when_http_500(self, m):
self.assertEqual(user.first_name, "")
self.assertEqual(user.infix, "")
self.assertEqual(user.last_name, "")
self.assertEqual(user.birthday, None)
self.assertEqual(user.street, "")
self.assertEqual(user.housenumber, "")
self.assertEqual(user.city, "")
Expand Down
1 change: 0 additions & 1 deletion src/open_inwoner/templates/pages/profile/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1 class="h1" id="title">
{% input form.display_name %}
{% input form.email %}
{% input form.phonenumber %}
{% date_field form.birthday no_help=True %}
{% input form.street %}
{% input form.housenumber %}
{% input form.postcode %}
Expand Down
4 changes: 0 additions & 4 deletions src/open_inwoner/templates/pages/profile/me.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ <h2 class="h2 title" id="personal-overview">{% trans "Persoonlijke gegevens" %}
<div class="tabled__item tabled__key">{% trans "Achternaam" %}</div>
<div class="tabled__item tabled__value">{{ user.last_name }}</div>
</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:"j F Y" }}</div>
</div>
<div class="tabled__row tabled__row--blank">
<div class="tabled__item tabled__key">{% trans "Adres" %}</div>
<div class="tabled__item tabled__value">
Expand Down
Loading