From: Ian B. <ia...@co...> - 2003-11-10 20:40:26
|
On Nov 10, 2003, at 1:12 PM, Sidnei da Silva wrote: > On Mon, Nov 10, 2003 at 06:20:47PM +0000, John Baker wrote: > | And back to deleting objects. If A has many Bs, there should be a > way of > | declaring it an 'owned relationship', in terms of 'when I delete A, > all my Bs > | are deleted'. > | > | Perhaps a flag on MultipleJoin. destroyChildrenWhenDestroyed=True > > Like a cascade delete? > > BTW, I wanted to know if there is cascade delete support on > SQLObject. I'm going to need it RSN :) No, no support. Right now you can do it manually by overriding destroySelf, e.g.: class Story(SQLObject): def destroySelf(self): for reply in self.replies: reply.destroySelf() super(Story, self).destroySelf() Certainly it could be added without great difficulty... a number of things need to happen with joins (like one-to-one joins need to be written, and a clearly documented many-to-many-with-extra-info join, like employee to client + rate). Then there's the possibility of making joins smarter, like SelectResults, so that you'd do things like employee.clients.append(aClient). -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |