CustomUser model has related field “viewed”. CustomUser.viewed returns all posts viewed by user, so I tried to get all author fields of viewed post in my view(ViewedPosts) but with a small change. I also need count of views and I want to implement this using annotate(views_count=Count(“views”)). This code is returning wrong results.
Please post the models involved here (CustomUser
and ViewedPosts
), along with a more detailed and specific description of the results you are receiving for one case along with the details of what you’re thinking you should be receiving.
(Note: I also changed the subject of your thread to more properly reflect the issue here.)