the first person to comment gets his name populated down the view as having 
made all of the comments regardless of who is logged in when commenting

so controller below needs to be changed:

def person_represent(id, r):
    row = db((db.auth_user.id==db.SuperObjectComment.created_by) 
            ).select().first()
    return '%s %s %s' % (row.auth_user.first_name, row.auth_user.last_name, 
row.auth_user.currentPosition)
db.SuperObjectComment.created_by.represent = person_represent

the word FIRST replaces all people in the view with the created_by field in 
the first record.  Of course if FIRST is replaced with the word LAST, then 
the last person to have commented has their name populate all view records 
with the created by field.

how to get the right person's name  associated with the right comment?   
(It is correctly associated in the table; just the view is wrong)

here is view:
{{extend 'layout.html'}}
<div style="float:right;margin:30px">{{=IMG(_src=URL('static', 
'images/engagement-squared-interaction.png'))}} </div>
<h2>
    Comments
</h2><h1 style="margin:0px 0px 40px 0px"> 
{{=A(commentsHeader.objectDisplayName)}}</h1>
<table>
  {{for objectComment in objectComments.render():}}
  <tr>
    <td>{{=objectComment.created_on}}</td>
    <td></td><td>{{=objectComment.created_by}}</td>
    <td>{{=MARKMIN(objectComment.superObjectComment)}}</td>
  </tr>
  {{pass}}
</table>
<hr>
{{=form}}


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