In models you can do:

db.mytable.myemail.represent = lambda email,row: A(email,_href='mailto:%s' 
% email)



On Thursday, 22 January 2015 19:22:17 UTC-6, Paul wrote:
>
>
> I am a web2py newbie though I've used Python for years. I need a CRMy kind 
> of application so I latched onto this 
> https://github.com/mdipierro/web2py-appliances/tree/master/CustomerRelationshipManagement
>  
> and am trying to tweak it for my specific needs. It would probably be 
> better to cut my teeth on something simpler, but oh well, there you have it.
>
> My newbie question: I added an email field to the person table. Every time 
> I view this datum I want this field, without exception, to be displayed as 
> a mailto anchor tag. Where in the MVC paradigm is the best place to define 
> this parameter?
>
> To elaborate a bit in the following view it's the crud.read that 
> automatically handles all the data iterations and display, yes? As a 
> workaround I know I could go with something like a for or while block and 
> walk through the data. I'd rather that the crud.read knows that it needs to 
> display the email field as a mailto anchor tag. That way my views will stay 
> synced with future data model changes which is one of the benefits of 
> web2py.
>
> {{extend 'layout.html'}}
> <h1>{{=person.name}}</h1>
> <h2>{{=person.role}} at {{=link_company(person.company)}}</a></h2>
>
> {{=button('edit','edit_person',person.id)}}
> {{=button('logs','list_logs',person.id)}}
> {{=button('docs','list_docs',person.id)}}
> {{=button('tasks','list_tasks',person.id)}}
>
> {{=crud.read(db.person,person)}}
>
> {{=tag('person',person.id)}}
>
>

-- 
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.

Reply via email to