Here's a simplified version of a model I'm working on:

db.define_table('story',
    Field('title'),
    Field('description', 'text'),
    Field('first_chapter', db.chapter)
)

db.define_table('chapter',
    Field('title'),
    Field('tale', 'text'),
    Field('story_id',db.story)
)

As you can imagine, I have a problem here. I cannot reference the
first chapter in the story table, because chapter is not yet defined,
but I cannot write the tables backwards, because story won't be
defined.
I was wondering if there's any way of doing this elegantly, or I'll
just have to count on the first chapter written of any story - to be
the first chapter.
Thanks in advance
Yaya

Reply via email to