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

[#309] Add separate fields for dutch addresses #329

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

danielmursa-dev
Copy link
Contributor

Fixes #309

[#309] Create and fix tests

[#309] Fix admin and schema
@danielmursa-dev danielmursa-dev force-pushed the feature/add-separate-fields-for-dutch-addresses branch from 2f31a2e to add1d20 Compare February 5, 2025 11:11
@danielmursa-dev danielmursa-dev changed the title Feature/add separate fields for dutch addresses [#309] Add separate fields for dutch addresses Feb 5, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.36%. Comparing base (e6a3ea4) to head (add1d20).
Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #329      +/-   ##
==========================================
+ Coverage   97.10%   97.36%   +0.26%     
==========================================
  Files         179      191      +12     
  Lines        8671     9543     +872     
==========================================
+ Hits         8420     9292     +872     
  Misses        251      251              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -17,6 +25,44 @@ class AdresMixin(models.Model):
validators=[validate_bag_id],
blank=True,
)
adres_straatnaam = models.CharField(
_("straatnaam"),
help_text=_("Straatnaam in het Basisregistratie Adressen en Gebouwen."),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to double check this with @alextreme, but from what I understand from the issue, these fields are only used if we don't have a BAG-id for the adres

Suggested change
help_text=_("Straatnaam in het Basisregistratie Adressen en Gebouwen."),
help_text=_("Straatnaam van het adres (indien het een Nederlands adres betreft zonder BAG-id)."),

src/openklant/components/contactgegevens/mixins.py Outdated Show resolved Hide resolved
src/openklant/components/contactgegevens/mixins.py Outdated Show resolved Hide resolved
src/openklant/components/contactgegevens/mixins.py Outdated Show resolved Hide resolved
src/openklant/components/contactgegevens/mixins.py Outdated Show resolved Hide resolved
help_text=_("Straatnaam in het Basisregistratie Adressen en Gebouwen."),
max_length=255,
blank=True,
null=True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null=True on string based fields is generally not desirable, because it means that there are two values at the database level for "no value": null and "" (see https://docs.djangoproject.com/en/4.2/ref/models/fields/#django.db.models.Field.null)

Could you remove it from the other charfields as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes right, I'm totally agree with you, but in this way I have to add default=True, because it gives me an error during migration because I have to set values for these fields also for the previous records, should I proceed in this way?

postcode:
type: string
description: Postcode in het Basisregistratie Adressen en Gebouwen.
pattern: ^[1-9][0-9]{3} ?[a-zA-Z]{2}$
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about allowing both lower and uppercase and space vs no space. Having this means that you can have different value for the same postcode (1234 AB vs 1234AB vs 1234 ab). Additionally the maxLength is incorrect if we allow spaces, because then it should be 7.

I'm fairly sure that only capital letters are allowed but I'm not 100% sure about having a space vs no space

@alextreme what do you think about this, should we make validation stricter to only allow one specific format, or should we normalize the values when saving them?

src/openklant/components/klantinteracties/models/mixins.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aparte velden voor Nederlandse adressen naast adresregel 1 t/m 3 voor buitenlandse adressen
3 participants