Re: [web2py] Re: New 'represent' syntax

2011-09-02 Thread Johann Spies
> Shouldn't it be IS_IN_DB(db, 'journal.id', ...) -- note 'journal.id' > rather than 'journal_id'? Also, your list:reference has to refer to a > referenced table. > > Well spotted! Thanks. That was my mistake. Regards Johann -- May grace and peace be yours in abundance through the full know

Re: [web2py] Re: New 'represent' syntax

2011-09-02 Thread Anthony
On Friday, September 2, 2011 10:47:42 AM UTC-4, spyker wrote: > > On 26 August 2011 17:07, Martín Mulone wrote: > >> To debug the problem, start passing one by one the fields: >> >> > The following models work: > > db.define_table('journal', > Field('title'), > Fiel

Re: [web2py] Re: New 'represent' syntax

2011-09-02 Thread Johann Spies
Sorry, > requires = IS_IN_DB('journal_id', 'title)%s', > zero = None) > must be requires = IS_IN_DB(db,'journal_id', '%(title)s', zero = None)), With the same result. Johann -- May grace and peace be yours in abundance through

Re: [web2py] Re: New 'represent' syntax

2011-09-02 Thread Johann Spies
On 26 August 2011 17:07, Martín Mulone wrote: > To debug the problem, start passing one by one the fields: > > The following models work: db.define_table('journal', Field('title'), Field('issn'), Field('subject'), Field('heading'),

Re: [web2py] Re: New 'represent' syntax

2011-08-26 Thread Martín Mulone
To debug the problem, start passing one by one the fields: fields = [db.dog.id, db.dog.owner ] SQLFORM.grid( ... fields=fields, ... ) 2011/8/26 Bruno Rocha > Do you have some field.of type list:... ? > > I am having trouble with it in grid. > > http://zerp.ly/rochacbruno

Re: [web2py] Re: New 'represent' syntax

2011-08-26 Thread Bruno Rocha
Do you have some field.of type list:... ? I am having trouble with it in grid. http://zerp.ly/rochacbruno Em 26/08/2011 10:54, "Johann Spies" escreveu: > Hallo Martín, > > Thanks for your reply. > > Unfortunately the problem persists: > > I have in Massimo's demo code for the SQLFORM.smartgrid/g

Re: [web2py] Re: New 'represent' syntax

2011-08-26 Thread Johann Spies
Hallo Martín, Thanks for your reply. Unfortunately the problem persists: I have in Massimo's demo code for the SQLFORM.smartgrid/grid: def index(): db.define_table('person',Field('name'),format='%(name)s') db.define_table('dog',Field('name'),Field('owner',db.person),format='%(name)s')

Re: [web2py] Re: New 'represent' syntax

2011-08-26 Thread Martín Mulone
Another thing when you are using SQLFORM.grid and .smartgrid this notation is required: db.dog.owner.represent = lambda value, row: db.person(value).name *because this notation raise an error:* db.dog.owner.represent = lambda value: db.person(value).name (take this in consideration or you are

Re: [web2py] Re: New 'represent' syntax

2011-08-26 Thread Martín Mulone
db.dog.owner.represent = lambda value, row: db.person(value).name Value is the value of the current field, in this example dog owner is an id of the person for example "1", so to display person name I have to pass this value to search a person with this id: db.person(value).name. Row is the all r

Re: [web2py] Re: New 'represent' syntax

2011-08-26 Thread Johann Spies
Thanks. It will be very helpful if somebody can update these lines in the book because it still not clear to me how to use the new syntax in each of these instances. I still do not know how 'record' is defined here. db.mytable.name.represent = lambda name: name.capitalize() db.mytable.other_id

[web2py] Re: New 'represent' syntax

2011-08-25 Thread Massimo Di Pierro
You just change this: def rp(author): an = db(db.akb_reprint.uuid==author).select(db.akb_reprint.rp_author) if len(an): a_name = an.first()['rp_author'] else: a_name = 'No rp_author' return a_name into this: def rp(author,record): an = db(db.akb_reprint.uuid==