I have a block called car_table and two kind of cars: blue and red. I want a template with two tables, one for the red cars and one for the blue cars, but I want to use just the 'general' block car_table.
in base_template.html I define the headers and general stuff
<!DOCTYPE html>
blablabla...
{% block content %}{% endblock %}
</html>
here is cars_table.html
{% extends base_template.html %}
{% block content %}
blablabla...
{% block table %}
...
{% for car in cars %}
<tr>
<td>{{ car.name }}</td>
</tr>
{% endfor %}
{% endblock %}
{% endblock %}
Now, I want a page with two tables: blue cars and red cars, using just the code in cars_table
both_tables.html) and the template with the actual table would be included (via{% include car_table.html %}) twice, each for one colour of cars, instead of extending the base template{% with red_cars as cars_for_loop %} {% include car_table.html %}{% endwith %}