[SQLObject] Sort order in MultipleJoin
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: deelan <de...@in...> - 2003-05-13 19:48:54
|
hi there, am i the only one having such basic requests, browsing the docs and found something related try stuff and achieve nothing? to recap: today i managed to get things work as expected with webware, cheetah and sqlobject. remember my little Person/PhoneNumber example used in a previos messages of mine? it was a simple MultipleJoin test. i instantiated a Person obj with: p = Person(1) #look up personId = 1 in db p.phoneNumbers #grab a list of PhoneNumber obj for person with this code i was able to grab such list and format an HTML table with cheetah, so far so good, but i was wondering, the result phonenumber list is unordered. is there a way to specifiy an order of such list? i've seen a _defaultOrder in the manual but seems related to Person.q or Person.select. i've tried to specify a _defaultOrder in PhoneNumber with: class PhoneNumber(SQLObject): """Phone number""" _defaultOrder = "PhoneType" ... where PhoneType is a mysql enum column. i've done that to group result by phone type (mobile, home, office) but i didn't get any visible results. any hint? i would like to be able to grab a list of numbers via the "phoneNumbers" attribute, since the syntax is very clear and most of the time it would be enough. thanks in advance later, deelan |