Re: [SQLObject] orderBy table.q.attribute
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ma...> - 2004-04-23 15:16:33
|
On Fri, Apr 23, 2004 at 04:50:23PM +0200, Philippe Normand wrote: > On Fri, Apr 23, 2004 at 06:48:43PM +0400, Oleg Broytmann wrote: > > Hello. > > > > How can I orderBy using table.q.attribute magic? > > > > patients = Patient.select(None, orderBy=-Patient.q.registrationTime) > > > > Well, what's the dash out there ? No difference without it: patients = Patient.select(None, orderBy=Patient.q.registrationTime) Traceback: [snip] if self.sourceClass._SO_columnDict.has_key(orderBy): TypeError: unhashable instance > If you want to order by registrationTime > DESC, used reversed param like: > > patients = Patient.select(orderBy=Patient.q.registrationTime, > reversed=True) What if I want to orderBy a complex condition? ...orderBy=[-registrationTime, name, surname] Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |