Hello! I have a view that lists some records (events), one of the fields (events.room_id) is a foreign key. When i display these records I want to display rooms.name, not events.room_id. Can someone give me a nudge (or swift kick) in the right direction on how to do this? I suspect a join of some sort is required, but that stuff confuses the hell out of me. I've included some relevant code below.
Thanks! #db.py db.define_table('rooms', Field('name'), ) db.define_table('events', Field('title'), Field('event_date', 'date'), Field('room_id', db.rooms) ) #default.py def index(): events = db().select(db.events.ALL, orderby=db.events.event_date) return dict(events=events) #index.html {{extend 'layout.html'}} <table> <tr> <td>Date</td><td>Event</td><td>Room</td> </tr> {{for event in events:}} <tr> <td>{{=event.event_date}}</td><td>{{=event.title}}</ td><td>{{=event.room_id}}</td> </tr> {{pass}} </table> -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@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.