Skip to content

Commit

Permalink
Added deprecation warning to NLBankAccountNumberField (#307)
Browse files Browse the repository at this point in the history
Ref: #150
  • Loading branch information
jieter authored and benkonrath committed Sep 19, 2017
1 parent 8f04d55 commit 24a5658
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
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
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

0 comments on commit 24a5658

Please sign in to comment.