Django forloop in template
Forloop is overriding the other, how do I use two different forloop in one template without interrupting each other. The 'include template" do not display its contents if 'for users in all_users' is the parents. How do I make 'for users in all_users' not to override 'for post in posts'.
What I tired: I tried using same context key but still not working, also tried using 'with' inside the include.html still no problem solved.
def ForYouView(request):
#All account users
all_users = Profile.objects.exclude(
Q(user=request.user)|
Q(friends__user=request.user)).order_by("?")
posts = Post.objects.all().order_by("?")
context = {
'posts': posts,
'all_users': all_users,
}
#Home template
{% for users in all_users %}
<div>{{ users.user }}</div>
{% include 'index_hover_card.html' %}
<div>{{ users.user.username }}</div>
{% endfor %}
#Include template
{% for post in posts %}
<div>{{ post.poster_profile.profile.user }}</div>
{% endfor %}