On Sun, Jan 25, 2009 at 06:30:26PM -0500, Michael LeSauvage wrote:
> Aha! I see where you're headed with this. As it turns out, the pages for a
> story truly are unordered.
Aha, I see - there is no a bigger problem. Well, the code for deferred
constrain creation is rather simple. This works for me:
class Story(SQLObject):
"""
Contains the first page, and meta about a story.
"""
title=UnicodeCol(alternateID=True, length=100)
summary=UnicodeCol()
pages=MultipleJoin('Page')
first_page=ForeignKey('Page', default=None)
class Page(SQLObject):
"""
A page in a story.
"""
short_title=UnicodeCol(alternateID=True, length=20)
text=UnicodeCol()
story=ForeignKey('Story', default=None)
constraints = Story.createTable(applyConstraints=False)
constraints += Page.createTable(applyConstraints=False)
for constraint in constraints:
Page._connection.query(constraint)
I don't know where to put the creation part so that tg-admin calls it.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss