1π
β
So my other thought was I could add all the variables that all the boxes might need to every page with a Context Processor, but is the ORM smart enough to only run the queries for pages that actually use those variables? Or is it going to hit the database even if I have no boxes on a page?
Yes, the ORM will be smart enough to do that. Django QuerySets are lazy: https://docs.djangoproject.com/en/dev/topics/db/queries/#querysets-are-lazy
π€lmz
5π
This is the use case for custom template tags. Read this article (written by one of the people behind Django).
One addition to Django since that article was written is the inclusion tag shortcut, which implements the βcall a little template fileβ approach you mention.
π€Ismail Badawi
- [Django]-Django ORM β Grouped aggregates with different select clauses
- [Django]-How does one create a custom 403 page in Django?
Source:stackexchange.com