1👍
✅
With access to the request
object in the view, you can get a list of item_id
s for the current user from the Seen table and filter using Django’s in
operator.
unseen_items = Item.objects.exclude(
pk__in=Seen.objects.filter(user_id=request.user).values_list(
'item_id', flat=True
)
)
Source:stackexchange.com