1👍
✅
You are using iterator()
which explicitly does not cache the results. When you do {% for course in menu.courses.iterator %}
, the results are fetched from the database again.
Use simply .all()
in your view instead of .all().iterator()
, and stop using .iterator in your template, and you shouldn’t have the problem.
Source:stackexchange.com