Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class UserProfile(models.Model):
  2. description = models.TextField()
  3.  
  4. class Channel(models.Model):
  5. subscribed = models.ManyToManyField(UserProfile,
  6. related_name="subscribed")
  7.  
  8. c = Channel.objects.get(pk=1)
  9. subscribed = c.subscribed_set.all()
  10. not_subscribed = UserProfile.objects.exclude(pk__in=[s.pk for s in subscribed])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement