for the record,
default=db(db.owner.isdefault==True).select().first().id
appears to work, note the addition of ìd.
Thanks
Vincent
On Thursday, June 7, 2012 9:49:30 PM UTC-5, Massimo Di Pierro wrote:
db(db.owner.isdefault=True).select()
should be
db(db.owner.isdefault==True).select()
Have you tried this:
db.define_table('dog',
Field('name','string'),Field('owner',db.owner,default=db(db.owner.isdefault=True).select().first()))
On Thursday, June 7, 2012 2:20:30 PM UTC-7, Vincent wrote:
Hi,
I'm looking for a way to define a default foreign key dynamically.
For example
Thanks for the suggestion.
It returns the following error:
SyntaxError: keyword can't be an expression
On Thursday, June 7, 2012 4:26:03 PM UTC-5, Derek wrote:
Have you tried this:
db.define_table('dog',
db(db.owner.isdefault=True).select()
should be
db(db.owner.isdefault==True).select()
On Thursday, 7 June 2012 16:48:57 UTC-5, Vincent wrote:
Thanks for the suggestion.
It returns the following error:
SyntaxError: keyword can't be an expression
On Thursday, June 7, 2012 4:26:03 PM
4 matches
Mail list logo