Code: Select all
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 %}
{{ users.user }}
{% include 'index_hover_card.html' %}
{{ users.user.username }}
{% endfor %}
#Include template
{% for post in posts %}
{{ post.poster_profile.profile.user }}
{% endfor %}