Skip to content

Commit

Permalink
[#309] Deleted 'land' field at root level
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Feb 27, 2025
1 parent 4073a7d commit 684545c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 75 deletions.
2 changes: 0 additions & 2 deletions src/openklant/components/contactgegevens/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class PersoonAdmin(admin.ModelAdmin):
"geslachtsnaam",
"geboortedatum",
"overlijdensdatum",
"land",
]
},
),
Expand Down Expand Up @@ -55,7 +54,6 @@ class OrganisatieAdmin(admin.ModelAdmin):
"handelsnaam",
"oprichtingsdatum",
"opheffingsdatum",
"land",
]
},
),
Expand Down
2 changes: 0 additions & 2 deletions src/openklant/components/contactgegevens/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Meta:
"oprichtingsdatum",
"opheffingsdatum",
"adres",
"land",
)
extra_kwargs = {
"uuid": {"read_only": True},
Expand Down Expand Up @@ -71,7 +70,6 @@ class Meta:
"voorvoegsel",
"voornamen",
"adres",
"land",
)
extra_kwargs = {
"uuid": {"read_only": True},
Expand Down
22 changes: 0 additions & 22 deletions src/openklant/components/contactgegevens/api/tests/test_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def test_persoon_detail(self):
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:persoon-detail",
Expand Down Expand Up @@ -56,7 +55,6 @@ def test_persoon_detail(self):
"voorvoegsel": "",
"voornamen": "John",
"adres": expected_adres,
"land": "CA",
}

response = self.client.get(detail_url)
Expand Down Expand Up @@ -85,7 +83,6 @@ def test_create_persoon(self):
"adresregel3": "adresregel3",
"land": "CA",
},
"land": "CA",
}

response = self.client.post(list_url, data)
Expand Down Expand Up @@ -115,7 +112,6 @@ def test_create_persoon(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

def test_update_persoon(self):
persoon = PersoonFactory.create(
Expand All @@ -135,7 +131,6 @@ def test_update_persoon(self):
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:persoon-detail",
Expand Down Expand Up @@ -169,7 +164,6 @@ def test_update_persoon(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

data = {
"geboortedatum": "1972-05-06",
Expand All @@ -190,7 +184,6 @@ def test_update_persoon(self):
"adresregel3": "changed",
"land": "FR",
},
"land": "FR",
}
response = self.client.put(detail_url, data)
data = response.json()
Expand All @@ -216,7 +209,6 @@ def test_update_persoon(self):
"land": "FR",
},
)
self.assertEqual(data["land"], "FR")

def test_update_partial_persoon(self):
persoon = PersoonFactory.create(
Expand All @@ -236,7 +228,6 @@ def test_update_partial_persoon(self):
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:persoon-detail",
Expand Down Expand Up @@ -270,7 +261,6 @@ def test_update_partial_persoon(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

data = {
"overlijdensdatum": "2023-11-22",
Expand Down Expand Up @@ -299,7 +289,6 @@ def test_update_partial_persoon(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

def test_list_pagination_pagesize_param(self):
list_url = reverse("contactgegevens:persoon-list")
Expand Down Expand Up @@ -331,7 +320,6 @@ def test_organisatie_detail(self):
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:organisatie-detail",
Expand All @@ -357,7 +345,6 @@ def test_organisatie_detail(self):
"opheffingsdatum": "2020-09-05",
"handelsnaam": "Devin Townsend",
"adres": expected_adres,
"land": "CA",
}

response = self.client.get(detail_url)
Expand All @@ -384,7 +371,6 @@ def test_create_organisatie(self):
"adresregel3": "adresregel3",
"land": "CA",
},
"land": "CA",
}

response = self.client.post(list_url, data)
Expand All @@ -411,7 +397,6 @@ def test_create_organisatie(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

def test_update_organisatie(self):
organisatie = OrganisatieFactory.create(
Expand All @@ -428,7 +413,6 @@ def test_update_organisatie(self):
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:organisatie-detail",
Expand Down Expand Up @@ -459,7 +443,6 @@ def test_update_organisatie(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

data = {
"handelsnaam": "changed",
Expand All @@ -477,7 +460,6 @@ def test_update_organisatie(self):
"adresregel3": "changed",
"land": "FR",
},
"land": "FR",
}
response = self.client.put(detail_url, data)
data = response.json()
Expand All @@ -499,7 +481,6 @@ def test_update_organisatie(self):
"land": "FR",
},
)
self.assertEqual(data["land"], "FR")

def test_update_partial_organisatie(self):
organisatie = OrganisatieFactory.create(
Expand All @@ -516,7 +497,6 @@ def test_update_partial_organisatie(self):
adres_adresregel2="adresregel2",
adres_adresregel3="adresregel3",
adres_land="CA",
land="CA",
)
detail_url = reverse(
"contactgegevens:organisatie-detail",
Expand Down Expand Up @@ -547,7 +527,6 @@ def test_update_partial_organisatie(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

data = {
"opheffingsdatum": "2023-11-22",
Expand All @@ -574,7 +553,6 @@ def test_update_partial_organisatie(self):
"land": "CA",
},
)
self.assertEqual(data["land"], "CA")

def test_list_pagination_pagesize_param(self):
list_url = reverse("contactgegevens:organisatie-list")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.17 on 2025-02-21 16:05
# Generated by Django 4.2.17 on 2025-02-27 10:22

import django.core.validators
from django.db import migrations, models
Expand All @@ -15,6 +15,14 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RemoveField(
model_name="organisatie",
name="land",
),
migrations.RemoveField(
model_name="persoon",
name="land",
),
migrations.AddField(
model_name="organisatie",
name="adres_huisnummer",
Expand Down
24 changes: 0 additions & 24 deletions src/openklant/components/contactgegevens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ class Organisatie(AdresMixin):
"significante onderdeel. Een voorbeeld: 2022-02-21"
),
)
land = models.CharField(
_("land"),
help_text=_(
"ISO 3166-code die het land (buiten Nederland) aangeeft alwaar de ingeschrevene verblijft."
),
validators=[
MinLengthValidator(limit_value=2),
validate_country,
],
max_length=2,
blank=True,
)

class Meta:
verbose_name = _("organisatie")
Expand Down Expand Up @@ -125,18 +113,6 @@ class Persoon(AdresMixin):
max_length=200,
blank=True,
)
land = models.CharField(
_("land"),
help_text=_(
"ISO 3166-code die het land (buiten Nederland) aangeeft alwaar de ingeschrevene verblijft."
),
validators=[
MinLengthValidator(limit_value=2),
validate_country,
],
max_length=2,
blank=True,
)

class Meta:
verbose_name = _("persoon")
Expand Down
24 changes: 0 additions & 24 deletions src/openklant/components/contactgegevens/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,6 @@ components:
- $ref: '#/components/schemas/OrganisatieAdres'
nullable: true
description: De adres gegevens van een organisatie.
land:
type: string
description: ISO 3166-code die het land (buiten Nederland) aangeeft alwaar
de ingeschrevene verblijft.
maxLength: 2
minLength: 2
required:
- handelsnaam
- url
Expand Down Expand Up @@ -519,12 +513,6 @@ components:
- $ref: '#/components/schemas/OrganisatieAdres'
nullable: true
description: De adres gegevens van een organisatie.
land:
type: string
description: ISO 3166-code die het land (buiten Nederland) aangeeft alwaar
de ingeschrevene verblijft.
maxLength: 2
minLength: 2
PatchedPersoon:
type: object
description: |-
Expand Down Expand Up @@ -585,12 +573,6 @@ components:
- $ref: '#/components/schemas/PersoonAdres'
nullable: true
description: De adres gegevens van een organisatie.
land:
type: string
description: ISO 3166-code die het land (buiten Nederland) aangeeft alwaar
de ingeschrevene verblijft.
maxLength: 2
minLength: 2
Persoon:
type: object
description: |-
Expand Down Expand Up @@ -651,12 +633,6 @@ components:
- $ref: '#/components/schemas/PersoonAdres'
nullable: true
description: De adres gegevens van een organisatie.
land:
type: string
description: ISO 3166-code die het land (buiten Nederland) aangeeft alwaar
de ingeschrevene verblijft.
maxLength: 2
minLength: 2
required:
- geboortedatum
- geslachtsnaam
Expand Down

0 comments on commit 684545c

Please sign in to comment.