I have two models
class Account(AbstractBaseUser, PermissionsMixin):
followers = models.ManyToManyField(
'Account', related_name='followers',
blank=True,
)
following = models.ManyToManyField(
'Account', related_name='following',
blank=True,
)
and
class Article(models.Model):
author = models.ForeignKey(
settings.AUTH_USER_MODEL,
null=True,
blank=True,
)
I'm writing an application where users subscribe to each other and create articles.
How can I make a request to receive all the articles from those to whom I am subscribed? I'm trying to do something like: (pseudo-code)
user = self.get_object()
articles = Article.objects.filter(author=user.followers.all())
But I know that this is not right