ah... a 'forward' reference;excellent! thanks weheh

On Feb 1, 1:32 pm, weheh <[email protected]> wrote:
> Try this:
> db.defint_table(...
> Field('previous_planet','reference planet'),
> ...)
>
> Then after the table definition:
> db.planet.previous_planet.requires=IS_NULL_OR(IS_IN_DB
> (db.db.planet.id))
>
> On Feb 1, 7:12 am, Carl <[email protected]> wrote:
>
>
>
> > If I want a planet record to point to another planet record?
>
> > If I use the following...
>
> > db.define_table('planet',
> >                 Field('radius', 'integer'),
> >                 Field('previous_planet', db.planet, requires=IS_NULL_OR
> > (IS_IN_DB(db,db.planet.id,'%(id)s'))))
>
> > I get KeyError: 'planet' which makes sense as planet doesn't exist at
> > the point I 'try' and refer to it.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to