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

Empty value django 1.11 #298

Merged
merged 3 commits into from
Jun 30, 2017
Merged

Conversation

benkonrath
Copy link
Member

@benkonrath benkonrath commented Jun 28, 2017

This PR adds support for the empty_value kwarg that was added to forms.CharField in Django 1.11.

On Django < 1.11, form fields that inherit from forms.CharField set an empty string for values that are in self.empty_values. On Django >= 1.11, form fields that inherit from forms.CharField set self.empty_value for values that are in self.empty_values. This means all of the fields now support the empty_value kwarg even when it's None.

The downside to this change is that form fields that inherit from forms.CharField will need to use the EmptyValueCompatMixin until we drop support for Django < 1.11.

Related #294 #295
Closes #297

@benkonrath benkonrath changed the title Empty value django 1.11 WIP Empty value django 1.11 Jun 28, 2017
@benkonrath benkonrath force-pushed the empty-value-django-1.11 branch 3 times, most recently from ac82d31 to bcade36 Compare June 28, 2017 20:58
@benkonrath benkonrath force-pushed the empty-value-django-1.11 branch from bcade36 to 7d7356d Compare June 28, 2017 21:15
@codecov-io
Copy link

codecov-io commented Jun 29, 2017

Codecov Report

Merging #298 into master will increase coverage by 0.28%.
The diff coverage is 99.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #298      +/-   ##
==========================================
+ Coverage   96.01%   96.29%   +0.28%     
==========================================
  Files         150      151       +1     
  Lines        4167     4214      +47     
  Branches      567      579      +12     
==========================================
+ Hits         4001     4058      +57     
+ Misses        107       97      -10     
  Partials       59       59
Impacted Files Coverage Δ
localflavor/sg/forms.py 100% <100%> (ø) ⬆️
localflavor/compat.py 100% <100%> (ø)
localflavor/cl/forms.py 93.75% <100%> (ø) ⬆️
localflavor/pk/forms.py 100% <100%> (ø) ⬆️
localflavor/mx/forms.py 92.62% <100%> (ø) ⬆️
localflavor/us/forms.py 91.42% <100%> (+0.12%) ⬆️
localflavor/il/forms.py 100% <100%> (ø) ⬆️
localflavor/br/forms.py 97.7% <100%> (+0.01%) ⬆️
localflavor/jp/forms.py 100% <100%> (ø) ⬆️
localflavor/si/forms.py 100% <100%> (ø) ⬆️
... and 29 more

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 7b92156...a7a6372. Read the comment docs.

@benkonrath benkonrath changed the title WIP Empty value django 1.11 Empty value django 1.11 Jun 29, 2017
@benkonrath
Copy link
Member Author

This is ready to go but I'd like to get some feedback if somebody has some time to double it. I'm planning to cherry pick 7d7356d into the 1.5.x branch and make a 1.5.2 release

@claudep
Copy link
Member

claudep commented Jun 30, 2017

Looks good to me, thanks!

@benkonrath benkonrath merged commit 961fd7d into django:master Jun 30, 2017
@benkonrath benkonrath deleted the empty-value-django-1.11 branch December 5, 2017 14:09
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