I am sure this is something simple that I am missing here when you do something like:
#model db.define_table('event', Field('description','text'), Field('creation_date','datetime', default=request.now), Field('start_date','datetime'), Field('creator', db.auth_user,default=auth.user.id if auth.is_logged_in() else 0), Field('latest','boolean',default=True)) db.event.creator.represent=lambda id: db.auth_user[id].email #controller def tonight(): from datetime import datetime, timedelta now = datetime.now() start = datetime.min.replace(year=now.year, month=now.month, day=now.day) end = (start + timedelta(days=1)) - timedelta.resolution tonight_query = (db.event.start_date > start) & (db.event.start_date < end) & (db.event.latest == True) events = db(tonight_query).select() return dict(events=events) #view {{extend 'layout.html'}} <h1>Events Tonight</h1> <ul> {{ for event in events: }} </li>{{ =event.creator }} : {{ =event.description }}</li> {{ pass }} </ul> The {{ =event.creator }} is still always an integer rather than using the representation defined in the model (db.auth_user.email). If I add {{=BEAUTIFY(response._vars)}} to the view, the table shows the event.creator field with the correct db.auth_user.email representation What am I missing here? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---