Re: ordering by fields in related models with Generic Relations

2010-02-17 Thread amenasse
sorry the last model was incorrectly pasted by me. class Tag(models.Model): # Content-object field content_type = models.ForeignKey(ContentType, verbose_name='content type', related_name="content_type_set_for_%(class)s") object_id = models.TextField('object ID') content_object = generic.Generi

ordering by fields in related models with Generic Relations

2010-02-17 Thread sysantmin
Hello, I have a Tag model which has a Generic Foreign Key . I want to order a query on the Tag model by fields in related models (related via the Generic Foreign Key), for Example: >>> [ o.content_object for o in >>> Tag.objects.order_by('content_type__id','foo__name','bar__name') ] Gives