Changes between Version 1 and Version 2 of Ticket #29340, comment 5
- Timestamp:
- Apr 20, 2018, 6:31:29 AM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29340, comment 5
v1 v2 2 2 > The extra queries are caused by accessing `event.location` which isn't cached. You could cache that as well using `Event.objects.select_related('location')`. Next time, please use [wiki:TicketClosingReasons/UseSupportChannels our support channels] if you need help confirming whether or not Django is at fault. 3 3 4 Sir I believe you didn't get my point. these two block of code should work just alike while they don't when certain conditions meet:4 Sir I believe you didn't get my point. these two blocks of code should work just alike while they don't when certain conditions meet: 5 5 6 6 {{{ … … 28 28 }}} 29 29 30 I've already cached the values of **event.location** so {{{get_or_set()}}} shouldn't make any sql queries. both of the variations are working fine outside of the loop but they behave differently when used inside a {{{for}}} loop. I nsorry for the inconvenience if I'm mistaken.30 I've already cached the values of **event.location** so {{{get_or_set()}}} shouldn't make any sql queries. both of the variations are working fine outside of the loop but they behave differently when used inside a {{{for}}} loop. I'm sorry for the inconvenience if I'm mistaken.