> It work:
>
> Topic.objects.filter(pk__in=[comment.content_object.pk for comment in
> Comment.objects.filter(user__exact = request.user)])
or:
Topic.objets.filter (comments__user=request.user)
if you add a 'reverse generic relation' field to Topic:
class Topic(models.Model):
.......
comments = generic.GenericRelation(Comment)
it won't add to the database fields, it just helps Django to build the
reverse relation
--
Javier
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment