0๐
โ
Try to remove menuitems
from view (or just donโt add menuitems
to context) and replace {% for item in menuitems %}
with {% for item in menu.menuitem_set.all %}
.
๐คf43d65
1๐
{% for item in menuitems %}
<p>Item {{ item.item_name }}</p>
<p>Description {{ item.description }}</p>
<p>$ {{ item.price }}</p>
{% endfor %}
Change this code to ,
{% for item in menu.menuitem.all %}
<p>Item {{ item.item_name }}</p>
<p>Description {{ item.description }}</p>
<p>$ {{ item.price }}</p>
{% endfor %}
๐คGeo Jacob
- Apache Django webpage is not saving values for long period of time
- What is proper workflow for insuring "transactional procedures" in case of exceptions
0๐
As @Geo Jacob has suggested, made those changes. Also in the view function, no need to set โmenuitemsโ variable in the context dictionary.
Source:stackexchange.com