From d6513d45703cc710f01ba924bb99cd35bfc8872b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 26 Oct 2014 17:44:36 +0000 Subject: [PATCH] return item id, exclude empty annotations --- pandora/annotation/models.py | 2 ++ pandora/annotation/views.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 65227adf..d99cabd4 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -237,6 +237,8 @@ class Annotation(models.Model): if layer or (keys and 'layer' in keys): j['layer'] = self.layer + if keys and 'item' in keys: + j['item'] = self.item.public_id if keys: _j = {} for key in keys: diff --git a/pandora/annotation/views.py b/pandora/annotation/views.py index 00d72ab6..595088e1 100644 --- a/pandora/annotation/views.py +++ b/pandora/annotation/views.py @@ -58,7 +58,7 @@ def order_query(qs, sort): order = '%s%s' % (operator, key) order_by.append(order) if order_by: - qs = qs.order_by(*order_by, nulls_last=True) + qs = qs.order_by(*order_by, nulls_last=True).exclude(value='') return qs def findAnnotations(request, data):