In model I have:
class BlogComment(SQLObject):
date = DateTimeCol(default = datetime.now)
commentText = StringCol()
commenter = ForeignKey('User', cascade = True)
entry = ForeignKey('BlogEntry', cascade = True)
To receive the comments on a certain blog entry, I have defined in my
controller:
@expose()
def getComments(self, entryId):
comments = list()
for comment in BlogComment.select(BlogComment.q.entryID == entryId,
orderBy =
BlogComment.q.date).reversed():
comments.append(dict(date = comment.date,
commenter = comment.commenter.display_name,
commentText = comment.commentText))
return dict(comments = comments)
Is this the good way to receive this information, or can it be done more
efficient?
--
Cecil Westerhof
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---