Vikash Balasubramanian
Vikash Balasubramanian

Reputation: 3233

web2py get row object from reqeust.vars

I have the folloowing code segment:

for row in rows:            
     FORM(INPUT(_type='submit',_value=row.Name),  _action=URL('Review',args=[course_id,year],vars=dict(row=row)), _method='post')

where row is a row object. But if i do:

request.vars.row 

from the called Review function It is of type 'str' with some string like

    <Row :{'Atribute Name',......}>

How do i pass the row object to that function?

Passing as args causes the same problem

Upvotes: 0

Views: 161

Answers (1)

Anthony
Anthony

Reputation: 25536

You cannot pass an entire dictionary as the value of a single variable in the query string. Given that the Row object is the only item in the query string, just convert it to a dictionary and pass that as the query string:

URL(..., vars=row.as_dict())

Then in the Review function, you would access individual field values as request.vars.field1, etc.

Upvotes: 1

Related Questions