I wanted something more generic to work with, for future uses. But I
guess you're right.

On Apr 7, 11:42 pm, villas <villa...@gmail.com> wrote:
> Why not simply write an onvalidation function?
>
> When you save a record with form accepts this would check to ensure
> that you only have one first_chapter for that story_id.
>
> On Apr 6, 9:29 pm,guruyaya<guruy...@gmail.com> wrote:
>
>
>
>
>
>
>
> > 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 thetablesbackwards, 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