Try latest trunk. You can do:
db.define_table('friendship: person by name birthday notnull, dog by
name ')
mind that you cannot have both notnull and unique and you cannot have
a unique reference because I just realized we lack a validator to do
it. I will make one and extend this..
Massimo
On Apr 13, 12:26 pm, mdipierro <[email protected]> wrote:
> Actually it does just
>
> db.define_table('friendship'
> ,SQLField('person_name')
> )
>
> but I am about to follow your suggestion (with a slight change in
> notation) and do
>
> db.define_table('friendship: person by name birthday notnull, dog by
> name ')
>
> generate:
>
> db.define_table('friendship'
> ,SQLField('person',requires=IS_IN_DB(db,'person.id','%(name) %
> (birthday)',notnull = True),
> ,SQLField('dog',requires=IS_NULL_OR(IS_IN_DB(db,'dog.id','%
> (name)')),
> )
>
> Massimo
>
> On Apr 13, 11:13 am, DenesL <[email protected]> wrote:
>
> > Maybe too short to be useful, but when you get to references it would
> > be nice to have:
>
> > db.define_table('friendship: person.name, dog.name')
>
> > But then, does this mean:
>
> > db.define_table('friendship'
> > ,SQLField('person_name'
> > ,db.person
> > ,requires=IS_IN_DB(db,db.person,'%(name)')
> > )...
>
> > or
>
> > ,SQLField('person_name'
> > ,db.person.name.type
> > ,db.person.name.length
> > ,requires=IS_IN_DB(db,db.person.name)
> > )...
>
> > On Apr 13, 2:16 am, mdipierro <[email protected]> wrote:
>
> > > In trunk you can now do
>
> > > db.define_table('person : Name, Birthday date, Telephone')
> > > db.define_table('dog: Name, Owner person, Picture upload')
>
> > > Is this useful? Look at the source. Is the syntax reasonable?
>
> > > Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---