I have models:
class Site(models.Model):
profile = models.ForeignKey(User)
class Profile(models.Model):
blacklist = models.ManyToManyField(Site)
How can i do equivalent of this query via django orm?
SELECT * FROM site WHERE 2 NOT IN (SELECT site_id FROM profile_blacklist WHERE profile_site.profile_id=site.profile_id)
I need some kind of blacklist filter. Each site has user (profile). This user has black list of sites. I do search for site with id=2 for exapmle. And i need sites witch owners has no site number 2 in blacklist.