[Answer]-Divide a categorized list into parts in django template

1👍

You want to use the slice filter:

{% regroup magazie_cats by category as service_list %}

{% for cat in service_list|slice:":3" %}
    {% for item in cat.list %}
        {{item.event.title}}
    {% endfor %}
{% endfor %}
{% for cat in service_list|slice:"3:6" %}
    {% for item in cat.list %}
        {{item.event.title}}
    {% endfor %}
{% endfor %}
{% for cat in service_list|slice:"6:9" %}
    {% for item in cat.list %}
        {{item.event.title}}
    {% endfor %}
{% endfor %}

Leave a comment