Hey guys,
I currently have the following:
db.define_table('bursary_users',
Field('forename', type='string', requires=IS_NOT_EMPTY()),
Field('surname', type='string', requires=IS_NOT_EMPTY()),
Field('studentId', type='string', requires=IS_NOT_EMPTY(),
unique=True),
Field('barcode', type='string', requires=IS_NOT_EMPTY(),
unique=True),
Field('email', type='string', requires=IS_EMAIL(), unique=
True),
Field('is_testuser', 'boolean'),
format='%(studentId)s'
)
db.define_table('bursary_entries',
Field('barcode', type='string', requires=[IS_IN_DB(db,
'bursary_users.barcode')]),
Field('entry_time', type='datetime', default=request.now,
readable=True, writable=False),
Field('entry_location', type='string', readable=True,
writable=False, requires=[IS_IN_DB(db, 'bursary_locations.bursary_location'
)]),
Field('bursary_at_time', type='string', readable=True,
writable=False, requires=[IS_IN_DB(db, 'bursary_users.bursary')]),
format='%(barcode)s'
)
And in my controller...
grid = SQLFORM.grid(query,
create=False,
editable=False,
deletable=False,
details=False,
paginate=50,
fields=[
db.bursary_entries.barcode,
db.bursary_entries.entry_time,
db.bursary_entries.entry_location
],
links=[
dict(header='Forename', body=lambda row:
db(db.bursary_users.barcode==row.barcode).select().first().forename),
dict(header='Surname', body=lambda row:
db(db.bursary_users.barcode==row.barcode).select().first().surname),
dict(header='Email', body=lambda row: db
(db.bursary_users.barcode==row.barcode).select().first().email)
])
But when I try to export my query as a CSV, I only get the 'fields' (Not
the links). Is there a way around this?
Kind regards,
James.
--
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.