Ive been trying to work out the best way to implement this query for awhile now but haven’t had much look
I have a very basic user following table..
class followTable(models.Model):
user = models.ForeignKey(User)
datetime = models.DateTimeField(auto_now_add=True)
taget_user = models.ForeignKey(User)
I want to be able to get all the users(target_user) that the current user is following then return all posts from another table that belong to the target_user, what would be the best way?
Ive tried
userlist = followTable.objects.filter(user=request.user)
then doing a foreach on the userlist and querying each user individually but that seems a bit messy, has any one got any suggestions?
1 Answer