Fastest way to lookup a product's price?

30 views
Skip to first unread message

emile....@gmail.com

unread,
Nov 15, 2018, 4:09:03 PM11/15/18
to django-oscar
Is there a faster way to look up a product price than- 
{% purchase_info_for_product request product as session %}
 
I have a page that I am putting all of my catalogue on, and querying for for the product price via the template tag `purchase_info_for_product` adds additional queries that, as I can tell, can't be stored in the template cache (because you must pass the request). That increases the load times and makes the page much too slow. 

Is there a faster way?

Thank you-

Samir Shah

unread,
Nov 15, 2018, 11:22:22 PM11/15/18
to django-oscar
There is no reason why you can't cache a template fragment that uses purchase_info_for_product - have you tried it?

Emile Petrone

unread,
Nov 16, 2018, 4:48:19 AM11/16/18
to django...@googlegroups.com
Thank you Samir, I was doing some template fragment caching, but not in the right places. That solved it. 

Thank you again

--
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/e0d53b7e-89ba-4c7f-9ece-5b8164644386%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages