Is there a way to get django to display nothing instead of “None” for a decimal field that is left blank?
In my template, I show a list of all the values for a specific field. Each value is a hyperlink to a page that displays the results of a query filtered by that value. But since there are some null-value entries, my list includes the actual DecimalField and "None" entries for all empty ones. When the user clicks No, django throws a validation error because you cannot query DecimalField with a string.
I could write if the operators check all instances of decimal fields for Nones and skip them, but this is far from an elegant solution. Any tips?
This is one part of the code, although there are other patterns that display the None value in several different ways:
{% for item in choices %}
<a href={% url app_views.field_choice item %}>{{ item }}</a><br>
{% endfor %}
source
share