-
Notifications
You must be signed in to change notification settings - Fork 295
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
Clean up Dutch local flavor. #152
Conversation
@jieter Sorry, this fell off my radar. I'll try to look at it later today. |
""" | ||
Validation for Dutch Sofinummers. | ||
|
||
TODO: consider renaming to BSN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree that it should be changed to BSN but let's do this as separate issue.
Besides those small points, it looks good. If you can fix these points, figure why the tests fail on 1.5 and get the docstrings written, then we can try to get it in the next release which is due shortly. Otherwise we'll shoot for the release after next when 1.5 support is dropped as per #170. |
message=self.default_error_messages['invalid']) | ||
self.no_leading_zeros_regex = re.compile('[1-9]+') | ||
def to_python(self, value): | ||
return '%s %s' % (value[:4], value[4:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a problem here. This is adding an extra space when the model field is used with the form field. For example, if I enter '1000AA', I will get the error message: 'Ensure this value has at most 7 characters (it has 8).' because the form adds a space and then this adds a space. You'll need to check if the space is already there before adding it. You should also add a test for this. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we just save it in the database without space and present it with a space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this seems to be fixed by the last commit I pushed.
Thanks for the feedback, I'll come back to this, hopefully next week. The delay pushed it somewhat down on my todo-list... |
Understandable. I'll keep my eyes peeled for your update. Thanks. |
Just pushed some improvements. I'm not going to invest time in adding 1.5 support if it's about to be removed anyway, so I'll guess we have to wait until after the next release then? Still working on the last bits to get this tested. |
acdf6e9
to
be8db15
Compare
I think it makes sense to wait until localflavor 1.2 is released so that we can skip trying to fix the errors with Django 1.5. Although I'm not sure when that's going to happen. The bug in the NL postal code model field in fact fixed but it would be nice to rework that bit of code to be more like the IBAN model. You should make sure you get 100% test coverage. There's a bit of the NL postal code model field that isn't tested and the bank account model field isn't tested as well. I know that we want to deprecate and drop the EU bank account fields but we should keep the tests in until the fields are removed. Thanks for your work on this. |
57db031
to
5a5e577
Compare
|
Nice catch on the forms.NLBankaccountField - I did see it but I just assumed it was already there. Nice work here - l'll merge this after localflavor 1.2 is released. |
I forgot to mention that you should rebase this and squash all your commits into one. Thanks. |
yes, will do. And what about the |
We'll have to wait to see what the version will be after 1.2. You can wait to squash everything once the |
5a5e577
to
338395f
Compare
Will squash again then. |
338395f
to
d28421d
Compare
All tests pass now, should I extend the docstrings with |
Yeah, Can you also add an entry to the changelog for this PR? The moved validator classes should be specifically mentioned as a breaking change so users know they will need to adjust their imports. I want to setup a deprecation policy for localflavor but we can sort that out before the next release. The final (small) change it to reset the commit date. Simply running |
d28421d
to
6dc8b6e
Compare
- Move validators to validators.py - Add model fields for existing form fields - Add form fields for existing model fields (except for NLBankAccountField) - Move tests to `tests/test_nl/` - Increase test coverage to 100% - More consistent error messages.
6f508a8
to
0d4ecfb
Compare
This should do it. |
Clean up Dutch local flavor.
@jieter Thanks for your work on this! |
@benkonrath any idea on when a version containing this PR is going to be released to pypi? |
I see, thanks for the update |
This is my initial attempt on #150. As of now, nothing is (or at least should be) renamed or deprecated. This is what I did:
tests/test_nl/
Known issues / TODOs:
RegExvalidator
somehow fails with messageEnter a valid value.
and notEnter a valid zip code.
. Any pointers to fix this?Please review!