I was thinking the same. So I've tried it like this:
{% for section in menusection %} <tr> <center> <h1
{{menusection}} </h1> </center> <th scope="col">Picture</th> <th scope="col">Name</th> <th scope="col">Ingredients</th> <th scope="col">Diet type</th> <th scope="col">Price</th> <div class="no-print"> <th scope="col">Options</th> <th scope="col"></th> <th scope="col"></th> </div> {% for meal in menu %} {% if meal.MealSection == menusection %} <tr> {% if meal.MealPicture %} <td><img src="{{meal.MealPicture.url}}"/></td> {% endif %} <td>{{meal.MealName}}</td> <td>{{meal.MealIngredients}}</td> <td>{{meal.MealDietType}}</td> <td>{{meal.MealPrice}} din.</td> <div class="no-print"> {% if user.is_staff %} <td> <a href="update/{{meal.id}}">Edit</a> </td> <td> <a href="delete/{{meal.id}}">Delete</a> </td> {% endif %} <td><a
Print</a> </td> </tr> </tr> {% endif %} {% endfor %} {% endfor %}
But it gives me:
<QuerySet \[<MenuSection: Appetizers>, <MenuSection: Soups>, <MenuSection: Vegetarian meals>, <MenuSection: Chicken meals>, <MenuSection: Fishes and sea food>, <MenuSection: Pizzas>, <MenuSection: Burgers>, <MenuSection: Pasta>]>
eight times, and there is no meals listed.