2👍
✅
Instead of include
tag which trying to find template named percent_style
you should simple use {{ percent_style }}
:
{% with "width: "|add:percent|add:"%" as percent_style %}
<div class="percentile" style="{{ percent_style }}" />
{% endwith %}
2👍
It seems to be easy to do, instead of trying to include
, just use the variable concatenated with the percent %
sign. You don’t need to use {% with %} {% endwith %}
<div class="percentile" style="width:{{ percent }}%" />
- [Django]-How to assign GROUP to user from a registration form (for user) in Django?
- [Django]-How to escape 'T' in django's date template tag
Source:stackexchange.com