-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix 0 value IntegerField in TemplateHTMLRenderer #5768
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
Conversation
Signed-off-by: Nikhil Sheoran <[email protected]>
The second check is required because |
I need to ensure this won't have side effets on non integer fields that rely on that template. |
@xordoquy Should I also include tests in the PR for the remaining non-integer fields that uses the |
We can list which falsy expressions led to no "value" rendering before:
Maybe, to be sure to only have impact when the value is a numeric 0 value should we test :
|
I'd suggest we just change it to
I don't really care about what |
@tomchristie As mentioned in the description as well, the second check is required because |
@tomchristie It makes sense to me too. I just wanted to list all the possible impacts the change has. |
@tomchristie Any updates on this? |
If the PR is updated (to the simpler solution) it should be good to go. |
Closing in favour of #5834. Thanks @nikhil96sher! |
Signed-off-by: Nikhil Sheoran [email protected]
Note: Before submitting this pull request, please review our contributing guidelines.
Description
Fixes #5767
The current implementation of
TemplateHTMLRenderer's input.html
for various template packs checked{% if field.value %}
which gave incorrect validation for IntegerField with 0 as input. This PR fixes it by checking{% if field.value is not None and field.value != "" %}