I have two models, Comment and Project. Comments are connected to a Project through a GenericForeignKey, and each Project is assigned to a particular user. I'd like to retrieve the latest comments for all the projects that a particular user is assigned to, but according to the Django documentation (and personal tests), a GenericForeignKey fields cannot be used directly with filter() or exclude(), so I can't do something like:
Comment.objects.filter(content_object__assigned_to=user).order_by ('date')[:10] I'm assuming I need to use the extra() method to accomplish something like this, but I am not very savvy with it, and would appreciate any help I could get in piecing it together for this scenario. Any other ideas would be appreciated as well. Thanks in advance! --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---