STOP PRESS - Got it!

So I've learned something new - *thanks again Anthony!*

Still not paying enough attention to the tracebacks - subsequent errors 
were a different problem.


for the record this virtual field definition...

db.person.display_name = Field.Virtual('display_name', get_user_short_name)




with this function...

def get_user_short_name(row):
    display_name = "NAME ERROR - unknown person type"

    if row.person.person_type == 'CLIENT':
        if row.person.referrer_ref:
            display_name = '%s %s' % (row.person.referrer_ref, 
row.person.first_name)
        else:
            display_name = 'PAP/%s %s' % (row.person.id, row.person.first_name)

    elif row.person.person_type == 'CONTACT':
        display_name = '%s, %s' % (row.person.last_name, row.person.first_name)

    print 'get_user_short_name(): returning name: >%s< for id >%s<' % 
(display_name, row.person.id)
    return display_name




produces the varied name format I was looking for

DisplayName: PAP/10 Evelyn 
DisplayName: PH 345562 Margaret

DisplayName: PAP/24 Matt

DisplayName: Gilmore, David 















-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to