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

Added deprecation warning to NLBankAccountNumberField #307

Merged
merged 5 commits into from
Sep 19, 2017
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
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Modifications to existing flavors:
(`gh-305 <https://github.com/django/django-localflavor/pull/305>`_).
- Added support for Swedish interim personal identity numbers
(`gh-308 <https://github.com/django/django-localflavor/pull/308>`_).
- Deprecated `nl.models.NLBankAccountNumberField`.
(`gh-307 <https://github.com/django/django-localflavor/pull/307>`_).

Other changes:

Expand Down
11 changes: 11 additions & 0 deletions localflavor/nl/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,20 @@ class NLBankAccountNumberField(models.CharField):
This model field uses :class:`validators.NLBankAccountNumberFieldValidator` for validation.

.. versionadded:: 1.1

.. deprecated:: 1.6
Use `localflavor.generic.models.IBANField` with included_countries=('nl') option instead.
Note that a data migration is required to move the data from this field to a new IBANField:
it needs to calculate check digits, add the bank identifier and zero-pad the bank number
into a proper IBAN.
"""

def __init__(self, *args, **kwargs):
self.system_check_deprecated_details = {
'msg': self.__class__.__name__ + ' is deprecated.',
'hint': "Use `localflavor.generic.models.IBANField` with included_countries=('nl') option instead."
}

kwargs.setdefault('max_length', 10)
super(NLBankAccountNumberField, self).__init__(*args, **kwargs)
# Ensure that only the NLBankAccountNumberFieldValidator is set.
Expand Down