Sunday, March 29, 2020

Rendering objects from two different queries in single For loop

Hello.

I am trying to fetch objects from two different queries by using select_related() in order to get all of the related objects.

In template, I am using For loop in order to render all objects of first model separately, as separate containers of the data.

Inside each of these rendered objects of the first model, I need to show the corresponding data from both queries for the related second model.

The issue is that, when I am using For loop in template, I can only get the objects for the first related query, but not for the second query which is also related to the first model (basically, what second query is doing is geting all of the objects based on date less then today.)


Please check out the hastebin link below for the code - models, view and template with detailed description of the issue and the intended result and let me know if you have any hint that I may apply.

https://hastebin.com/yayoketume.makefile

Thank you very much.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4336ef2a-9ed6-4e91-a294-5ed1f633a2fe%40googlegroups.com.

No comments:

Post a Comment