319👍
✅
You want the default_if_none
template filter, (doc).
default_if_none
will display the given string if the variable is ‘None’.
default
will display the string if the variable evaluates to False, ie empty strings, empty lists etc
{{ item.somefield|default_if_none:"" }}
{{ item.somefield|default:"" }}
- [Django]-Django test app error – Got an error creating the test database: permission denied to create database
- [Django]-How do you dynamically hide form fields in Django?
- [Django]-Django queryset filter – Q() | VS __in
Source:stackexchange.com