[web2py] Re: CRUD .represent question #2

2012-03-08 Thread Gian Luca Decurtins
> > That's not how it works. When the table is defined, if you have > Field('location', db.location, ...) with no explicit "represent=...", then > it will automatically set the "represent" attribute for you based on the > _format attribute of the db.location table. However, if you set an explic

[web2py] Re: CRUD .represent question #2

2012-03-08 Thread Anthony
> > I've removed the two lines, but the behavior is still the same. So there > must be an other error in my code? > Hmm, I would think it should work -- not sure what the problem is. > My idea is that the format does specify the string for db.object.location > and the db.object.location.repr

[web2py] Re: CRUD .represent question #2

2012-03-08 Thread Gian Luca Decurtins
> > db.object.location.represent = lambda location, row: \ >>A(location,_href=URL('location', 'update', args=(location.id), >> user_signature=True)) >> > > In the above line, you have specified your own "represent" attribute for > the "location" field, so it will not use the "format"

[web2py] Re: CRUD .represent question #2

2012-03-08 Thread Anthony
> > db.object.location.represent = lambda location, row: \ >A(location,_href=URL('location', 'update', args=(location.id), > user_signature=True)) > In the above line, you have specified your own "represent" attribute for the "location" field, so it will not use the "format" attribu

[web2py] Re: CRUD .represent question

2012-03-07 Thread Gian Luca Decurtins
Hi Yes you're right! But I had to remove the db.location.id.readable = False line. Else it doesn't work. Thank you for helping! -Luca. Am Mittwoch, 7. März 2012 12:18:41 UTC+1 schrieb Alan Etkin: > > row.id should contain the record id, shouldn't it? > > db.location.name.represent = lambda

[web2py] Re: CRUD .represent question

2012-03-07 Thread Alan Etkin
row.id should contain the record id, shouldn't it? db.location.name.represent = lambda name, row: \ A(name, _href=URL('update', args=row.id, user_signature=True)))

[web2py] Re: CRUD .represent question

2012-03-07 Thread Gian Luca Decurtins
Hi This is exactly the example from which I started. I've removed the request.args(0) part, because I do not need the generic controller as I already know which table I want to display. I want to change the representation of db.location.name: Display db.location.name, but use db.location.id for

[web2py] Re: CRUD .represent question

2012-03-07 Thread Alan Etkin
Look at this example (at the book's crud - methods): A('edit:',id,_href=URL(args=(request.args(0),id))) I think you need to pass a sequence to args (, ) for the required behavior. Not sure really, as I didn't use the example. On Mar 7, 7:15 am, Gian Luca Decurtins wrote: > Hi all > > I would li