6π
On the html you can use the tick symbol in this unicode format ✔
result β
And also you can use the times symbol in this html format ×
result Γ
Reference :
What is the proper HTML entity for the "x" in a dimension?
EDIT
Option 1 β works but it is not suggested
If {{ variable }}
returns TRUE
or FALSE
you can check it with javascript
<td>
<script type="text/javascript">
if( "{{ variable }}" === "FALSE" ) {
document.write("Γ");
} else {
document.write("β");
}
</script>
</td>
The above option is NOT SUGGESTED. If you use it in a wrong way it will create problems and security holes (at least escape your strings).
Option 2 β better in this case (suggested)
In the Django template, check if true or false
<td>{% if variable == True %}✔{% else %}×{% endif %}</td>
For more fancy icons check FontAwesome
EDIT 2:
For true/false variables also check tukyβs answer, it is a cleaner solution.
1π
I prefer to use the more concise yesno
template filter (https://docs.djangoproject.com/en/2.2/ref/templates/builtins/#yesno):
<td>{{ variable|yesno:"β,β" }}</td>
It also supports an optional 3rd value that will be used, if variable
is None
.
1π
{% if variable %}
<span class="fas fa-check-square" style='font-size:24px;color:green'></span>
{% else %}
<span class="fas fa-window-close" style='font-size:24px;color:red'></span>
{% endif %}
- [Django]-How does Django determine if an uploaded image is valid?
- [Django]-Django create dates list from queryset
- [Django]-How to use C# client to consume Django/Python web service (all methods are returning null)?