3👍
It’s about Template Language.
Variables look like this:
{{ variable }}
.Filters look like this:
{{ name|lower }}
.Tags look like this:
{% tag %}
.To comment-out part of a line in a template, use the comment syntax:
{# #}
There is no such thing as {{% %}}
So, instead of
{{% for myitem in cate.items_by_category.all %}}
You should use
{% for myitem in cate.items_by_category.all %}
Reference:
https://docs.djangoproject.com/en/3.0/ref/templates/language/
1👍
The template tags are sourrounded with {% … %}
, not
. So you should rewrite the template to:{{% … %}}
{% extends 'orders/base.html' %}
{% load static %}
{% block title %}
Menu
{% endblock %}
{% block body %}
<ul>
{% for cate in Categories %}
<li>{{ cate.category_name }}</li>
<ul>
{% for myitem in cate.items_by_category.all %}
<li>{{ myitem.item_name }}</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
Source:stackexchange.com