add comment_key optional parameter for /api/comments/ to fetch a single comment
authorgibus
Fri, 19 Nov 2010 18:02:33 +0100
changeset 335 74dbc5568bbd
parent 334 f02debb25475
child 336 f7fb42d3f526
add comment_key optional parameter for /api/comments/ to fetch a single comment
src/cm/api/handlers.py
--- a/src/cm/api/handlers.py	Fri Nov 12 15:43:03 2010 +0100
+++ b/src/cm/api/handlers.py	Fri Nov 19 18:02:33 2010 +0100
@@ -437,12 +437,15 @@
     def read(self, request):
         name = request.GET.get('name', None)
         limit = request.GET.get('limit', None)
+        comment_key = request.GET.get('comment_key', None)
         keys = request.GET.get('keys', None)
         query = Comment.objects.all()
         if keys:            
             query = query.filter(text_version__text__key__in=keys.split(','))
         if name:
             query = query.filter(name=name)
+        if comment_key:
+            query = query.filter(id_key=comment_key)
         query = query.filter(text_version__text__last_text_version__exact=F('text_version__id'))
         query = query.order_by('-created')
         if limit: