is it possible to have represent for foreign key table?
e.g.
db.define_table('address',
Field('address', 'text'),
Field('zip_code'),
Field('city'),
Field('country'),
format = lambda r: '%s, %s, %s, %s' % (r.address, r.zip_code, r.city,
r.country) )
def on_define_id_card(table):
"""
table.address.represent = lambda value, field: \
A('%s, %s, %s' % (field.address.address, field.address.city,
field.address.country),
_title=T("View Maps"), _target="_blank",
_href="http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=%s,+%s,+%s"
% (field.address.address, field.address.city, field.address.country) ) *if
value else ''*
"""
table.address.represent = lambda value, field: \
A('%s, %s, %s' % (field.address.address, field.address.city,
field.address.country),
_title=T("View Maps"), _target="_blank",
_href="http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=%s,+%s,+%s"
% (field.address.address, field.address.city, field.address.country) ) *if
field.address.address else ''*
db.define_table('id_card',
Field('id_card_type'),
Field('id_card_number'),
Field('first_name'),
Field('last_name'),
Field('place_of_birth'),
Field('date_of_birth', 'date'),
Field('gender'),
Field('blood_type'),
Field('address', 'reference address'),
Field('religion'),
Field('marital_status'),
Field('occupation'),
Field('nationality'),
Field('registration_date', 'date'),
Field('expiration_date', 'date'),
Field('id_card_scan', 'upload'),
on_define = on_define_id_card,
format = lambda r: '%s : %s - %s %s' % (r.id_card_type, r.id_card_number,
r.first_name, r.last_name) )
like in example above, i've tried before, it run nice, the nightmare comes,
when the parents row table is delete, any idea how to face this using
web2py way?
thanks and best regards,
stifan
--
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.