When I try that, this error occurs: 'Row' object has no attribute 'id'
On Friday, March 6, 2015 at 1:47:08 PM UTC-5, Anthony wrote:
>
> It should be args=row.id, not args=db.session.id (the former is the value
> of the id for the current record, and the latter is the actual id Field
> object).
>
> Anthony
>
> On Friday, March 6, 2015 at 1:37:22 PM UTC-5, Oliver Holloway wrote:
>>
>> In the following table, the session_name is represented as a link. I want
>> to pass session.id in args (rather than args=1 as you see below). How do
>> I do that? I've tried various ways to say args=db.sessions.id, and it's
>> as if the sessions.id value is not being picked up.
>>
>> db.define_table('sessions',
>> Field('program_name', 'string', requires=IS_IN_DB(db,
>> db.programs.program_name)),
>> Field('session_type', 'string',
>> requires=IS_IN_SET(['practice', 'evaluation'], zero=None)),
>> Field('session_number', 'integer', default=1), # this is
>> the session number by program
>> Field('coach', 'string'),
>> Field('assistant', 'string'),
>> Field('session_date_time', 'datetime'),
>> Field('session_name', compute = lambda row:
>> row.program_name + ', ' + row.session_type + ' ' + str(row.session_number))
>> )
>>
>> db.sessions.session_name.represent = lambda session_name, row:
>> A(session_name, _href=URL('tests_for_this_eval', args=1))
>>
>> Any help is much appreciated.
>>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.