Tuesday, 6 August 2013

trying to sort on a reference property of an entity but don't want to sort on object but a ppty of the object

trying to sort on a reference property of an entity but don't want to sort
on object but a ppty of the object

Say I have done a query and I want to then order it by a reference
property attribute - can I temporarily add a field in the results of my
query and add in the attribute to sort it before I send it to the
template?
q = LetterTable.all().order('votes)
but then I want to take the q results above and sort on a property of
LetterTable called "Person". However, 'person' is a reference to an
instance on the PersonTable, so I don't want the reference object, I want
to sort by person.name. How can I do this?
Anyone?

No comments:

Post a Comment