Represent can return anything you want. You can make your represent
function return a dict, list, tuple or whatever, there you can have the
telephone represented as a whatsapp link and as a regular telephone link.
from gluon.storage import Storage
import urllib
def phone_representer(value, row):
encoded_value = urllib.quote(value)
return Storage(tel=A(value, _href='tel:%s' % encoded_value ),
whatsapp=A(value, _href='
https://api.whatsapp.com/send?phone=%s
<https://api.whatsapp.com/send?phone=123>' % encoded_value)
)
db.mytable.mobile_phone.represent = phone_representer
Then in a view you could do something like:
{{=record.mobile_phone.whatsapp}}
--
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.