Re: ordering by generic foreign key

2012-10-19 Thread Bastian
I tried that: favorites = Photo.objects.filter(likes__user=user).order_by("-likes__id") and it seems to work well in all the tests. The only thing I don't understand is how it works. Because in this generic relation there are various 'likes' for each 'Photo' object and so the 'filter(likes__us

ordering by generic foreign key

2012-10-18 Thread Bastian
Hi, I'm not sure to understand what I'm doing here :) I have a model of a photo with name, description, image field... and a generic foreign key called 'likes' to store the photo in users' favorites: likes = generic.GenericRelation(Like) and in the Like model I have: user = models.ForeignKey(Us