OK, my head is starting to give small smokes signals from thinking of how to build this validator. I can, for now, count on the fact that the first chapter is the first row. And yet, I'm quite sure I'll have to think of something sometime soon.
On Apr 7, 7:51 am, guruyaya <guruy...@gmail.com> wrote: > The first is an option. But thinking of other models, like questions > and the best answer, will still be a problem. > I thought of a validator, that will go something like this: > > db.define_table('story', > Field('title'), > Field('description', 'text'), > ) > db.define_table('chapter', > Field('title'), > Field('tale', 'text'), > Field('story_id',db.story) > Field('is_first_chapter','boolean', default=false) > ) > db.chapter.is_first_chapter.requires = > IS_ONLY_ONE_IN_GROUP(group='story_id',only_one_value=true,others_value=fals > e); > > I'll try and write this validator sometime this weekend, and see how > it goes. > On Apr 6, 11:36 pm, pbreit <pbreitenb...@gmail.com> wrote: > > > > > > > > > Or I could see keeping track of which chapter_number a chapter is in the > > chapter table (do chapters only belong to one book?).