Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add flat_comments helper method to Document class

  • Loading branch information...
commit ea49395c23eb659e04618cb80c112ff1773844a8 1 parent 0050fe4
@rosarior authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 apps/document_comments/__init__.py
View
7 apps/document_comments/__init__.py
@@ -40,6 +40,11 @@
register_links(Comment, [comment_delete])
register_links(Document, [comments_for_document], menu_name='form_header')
+
+def flat_comments(document):
+ return u' '.join(document.comments.values_list('comment', flat=True))
+
+
Document.add_to_class(
'comments',
generic.GenericRelation(
@@ -49,6 +54,8 @@
)
)
+Document.add_to_class('flat_comments', flat_comments)
+
class_permissions(Document, [
PERMISSION_COMMENT_CREATE,
PERMISSION_COMMENT_DELETE,
Please sign in to comment.
Something went wrong with that request. Please try again.