I have the next models:
class Sentence(models.Model):
text = models.CharField(max_length=200)
language = models.ForeignKey(Language)
pub_date = models.DateTimeField()
class Traduction(models.Model):
sentence_from = models.ForeignKey(Sentence, related_name='st_traductions_from')
sentence_to = models.ForeignKey(Sentence, related_name='st_traductions_to')
I want to get sentence objects order by the number of Traduction object related with them. I tried it with:
sentences = Sentence.objects.annotate(num_traductions=Count('st_traductions_from')) \
.order_by('-num_traductions')
But it raise the next exception when I iterate it:
Caught DatabaseError while rendering: This query is not supported by the database
I'm using appengine and Django-nonrel.
Thanks.