Skip to content

Add NLLicensePlateField with tests#327

Merged
benkonrath merged 2 commits intodjango:masterfrom
jarmovanlenthe:NLLicensePlate
Feb 23, 2018
Merged

Add NLLicensePlateField with tests#327
benkonrath merged 2 commits intodjango:masterfrom
jarmovanlenthe:NLLicensePlate

Conversation

@jarmovanlenthe
Copy link
Copy Markdown
Contributor

Added a ModelField and Validator for Dutch License Plates (NLLicensePlateField) and a FormField (NLLicensePlateFormField) which also sanitizes input.

All Changes

  • [DONE] Add an entry to the docs/changelog.rst describing the change.

  • [DONE] Add an entry for your name in the docs/authors.rst file if it's not
    already there.

  • [DONE] Adjust your imports to a standard form by running this command:

    `isort --recursive --line-width 120 localflavor tests`
    

New Fields Only

  • [DONE] Prefix the country code to all fields.

  • [DONE] Field names should be easily understood by developers from the target
    localflavor country. This means that English translations are usually
    not the best name unless it's for something standard like postal code,
    tax / VAT ID etc.

  • [DONE] Prefer 'PostalCodeField' for postal codes as it's
    international English; ZipCode is a term specific to the United
    States postal system.

  • [DONE] Add meaningful tests. 100% test coverage is not required but all
    validation edge cases should be covered.

  • [DONE] Add .. versionadded:: <next-version> comment markers to new
    localflavors.

  • [DONE] Add documentation for all fields.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 19, 2018

Codecov Report

Merging #327 into master will increase coverage by <.01%.
The diff coverage is 97.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #327      +/-   ##
==========================================
+ Coverage   95.88%   95.89%   +<.01%     
==========================================
  Files         153      153              
  Lines        3818     3851      +33     
  Branches      508      511       +3     
==========================================
+ Hits         3661     3693      +32     
  Misses         96       96              
- Partials       61       62       +1
Impacted Files Coverage Δ
localflavor/nl/validators.py 100% <100%> (ø) ⬆️
localflavor/nl/models.py 100% <100%> (ø) ⬆️
localflavor/nl/forms.py 97.36% <94.11%> (-2.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0cb32b...31e0ffb. Read the comment docs.

Copy link
Copy Markdown
Member

@benkonrath benkonrath left a comment

Choose a reason for hiding this comment

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

Nice job on this! Only the 2 small changes and I'll merge it. Thanks for your contribution!

Modifications to existing flavors:

- None
- Added `NLLicensePlateField` to NL flavor.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The entry is only needed once in the 'New fields for existing flavors' section.


class NLLicensePlateField(models.CharField):
"""
A Dutch car license plate.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's probably better to remove 'car' as this can be used for all Dutch license plates.

@benkonrath benkonrath merged commit 9d5fccd into django:master Feb 23, 2018
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.

3 participants