Queryset not working

def get_queryset(self):
return models. Post. objects. filter(user__person1 = self. request. user. pk)

no post shown on browser
indentation is proper in code not above
self. request. user doesnt show output if i put user__person1 = 3 then show output

i also apply Q queryset but no output come

When i want to get posts by my friends or myself post in Social media app,

So in class Wall i have generating query for desired output

Overriding the function get_queryset

Return models.Post.object.filter(user__person1 = self.request.user.pk)

It doesn’t show posts

But if i put return models.Post.objects.filter(user__person1 = 3) 3 is objects no shown in Friends table output shown in browser in attached photo

It give post of mine

But. user__person1 = self.request.user.pk

Not working so i unable to get posts from my different friends output shown blank as shown in attached image.

Thanking you

Shubham Verma

Hey @vermas.123, can you pls share your code and is person1 is the name of the variable ??

1 Like