1👍
✅
This should work:
{% with get_item_news.inner_image_position as alignment %}
<img src = "{{MEDIA_URL}} {{get_item_news.image}}"
alt = "" style = "float: {{ alignment }};"/>
{% endwith %}
0👍
Try this ,
{% if get_item_news.inner_image_position == 'left'%}
<img src = "{{MEDIA_URL}} {{get_item_news.image}}" alt = "" style = "float:left"/>
{%else%}
<img src = "{{MEDIA_URL}} {{get_item_news.image}}" alt = "" style = "float:right"/>
{%endif%}
- [Answer]-Django – Getting form field by string var
- [Answer]-Server Error (500) in accessing a section in Django app
- [Answer]-Django Rest Framework: empty list when using RelatedField
Source:stackexchange.com