what the problem here?
you can get all your Feeds by
and then all the comments for each feed
or what?
if you want to get only comments, you can do
On Sunday, August 6, 2017 at 1:06:56 PM UTC+3, 时空路由器 wrote:
-- you can get all your Feeds by
feeds = Feed.objects.filter(user=me)comments = feed.comment_set.exclude(user=me)if you want to get only comments, you can do
comments = Comment.objects.filter(feed__in=feeds).exclude(user=me)On Sunday, August 6, 2017 at 1:06:56 PM UTC+3, 时空路由器 wrote:
there are three classesclass User(models.Model):
name = models.CharField()
class Feed(models.Model):
user = models.ForeignKey(User)
class Comment(models.Model):
user = models.ForeignKey(User)
feed = models.ForeignKey(Feed)How to get all my feeds and all the coments of them, but the user of comment are not mine
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aca52eae-b227-4b31-b0be-70434bab9e01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment