python - django print only one value in for loop in template -
i want display 1 value loop in template. let's have this:
{% category in categories %} {{category.name}} <a href="{% url "my_url" category.id %}">see all</a> {% endfor %}
if have 5 category see in being printed 5 times. how can print once.. thanx in adnvance..
you have limit object , send object template
tempalte_var['content'] = categories.objects.all()[:5]
Comments
Post a Comment