I have the following two database model:
class UserProfile(models.Model):
description = models.TextField()
class Channel(models.Model):
subscribed = models.ManyToManyField(UserProfile,
related_name="subscribed")
Given, a channel I want to display the users subscribed to the channel in one column and the ones who are not subscribed to the channel in other column.
Getting the users who are subscribed to a channel is no issues. How do I select the users who are not subscribed to the channel and the send the user profile objects of users who are not subscribed.
Just use
excludeinstead offilter.