I have a problem using SQLFORM.grid and its fields option.
fields= enables me to specify which fields to retrieve from the db, and
those fields are then displayed to the user.
The problem is, I would like to read from the database also some additional
fields, which are NOT displayed to the user, but that can be used in
generating links. For instance, I would like this code to work. Notice
how I am not including db.submission.contest_id in the fields, but I would
like to use it in the links (hence, this code is currently broken).
Is there a way to do this? Shall I implement in web2py a new optional
parameter for SQLFORM.grid called extra_fields?
Many thanks! --Luca
grid = SQLFORM.grid(q,
fields=[db.submission.id, db.submission.date],
csv=False, details=False, create=False, editable=False,
user_signature=False,
args=request.args[1:],
links=[
dict(header=T('Contest'), body = lambda r:
A(T('Contest'), _href=URL('contests', 'view_contest',
args=[r.contest_id]))),
dict(header=T('Submission'), body = lambda r:
A(T('submission'), _href=URL('submission',
'view_own_submission', args=[r.id]))),
dict(header=T('Feedback'), body = lambda r:
A(T('feedback'), _href=URL('view_feedback', args=[r.id]))),
],
)
--