A
A
Anton2015-12-26 12:44:20
Django
Anton, 2015-12-26 12:44:20

Why is the loop not working correctly in a django template?

There is code like this in a Django template:
https://jsfiddle.net/0k65hdoq/
I expect the result to be multiple p.inner tags inside p.sizes. In reality, all p.inners follow p.sizes, and even inside p.sizes, a lot of spaces have accumulated from somewhere:
https://jsfiddle.net/0k65hdoq/1/
Question: what did I do wrong? Where is the error in the template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2015-12-26
@vintello

try like this

{% for prod in product %}
             <p class="inner">{{ prod.size }}</p>
           {% endfor %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question