Fix 0 value IntegerField in TemplateHTMLRenderer#5768
Fix 0 value IntegerField in TemplateHTMLRenderer#5768nikhil96sher wants to merge 1 commit intoencode:masterfrom nikhil96sher:issue-5767
Conversation
Signed-off-by: Nikhil Sheoran <nikhilsheoran96@gmail.com>
|
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 nikhilsheoran96@gmail.com
Note: Before submitting this pull request, please review our contributing guidelines.
Description
Fixes #5767
The current implementation of
TemplateHTMLRenderer's input.htmlfor 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 != "" %}