Duplication of Query - reg

26 views
Skip to first unread message

Raja Sekar Sambath

unread,
Dec 26, 2019, 8:59:42 PM12/26/19
to django...@googlegroups.com
Hi,

I have a table of data with self relation , I am Querying all records and displaying them in tabular format in a template

I find a strange behaviour that the query has been executed recursively for each records of table, any better / suggestion solution for this issue.



image.png

--
Thanks & Regards,

Raja Sekar Sampath

Sencer Hamarat

unread,
Dec 27, 2019, 2:47:13 AM12/27/19
to django...@googlegroups.com
Hi,

That could be a behavior of a template tag or a "for" block in the template.
You may consider to use ".select_related" and ".prefetch_related" in view.

Saygılarımla,
Sencer HAMARAT



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAS5AE7EfWrDp7V_b-Uw%3DOFB-O02nXr%3De5ODomEH1sRUB3QeFg%40mail.gmail.com.

Raja Sekar Sambath

unread,
Dec 27, 2019, 12:20:04 PM12/27/19
to django...@googlegroups.com
Hi,

Thanks for your reply, I have included select_related in my view but no result.

Reply all
Reply to author
Forward
0 new messages