summaryrefslogtreecommitdiffstats
path: root/apps/it/views.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2014-02-24 19:31:23 +0200
committerFilipp Lepalaan <f@230.to>2014-02-24 19:31:23 +0200
commit615f73881baf3ae7837ee23467998875a944177f (patch)
tree655a01e7c2131a8ee6be71af790ea2f895374668 /apps/it/views.py
parent993f654f7e3334b235391a8d1f779c3e715a610d (diff)
downloadpudding-615f73881baf3ae7837ee23467998875a944177f.tar.gz
pudding-615f73881baf3ae7837ee23467998875a944177f.tar.bz2
pudding-615f73881baf3ae7837ee23467998875a944177f.zip
Better
Diffstat (limited to 'apps/it/views.py')
-rw-r--r--apps/it/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/it/views.py b/apps/it/views.py
index 963f41f..2461560 100644
--- a/apps/it/views.py
+++ b/apps/it/views.py
@@ -170,15 +170,17 @@ def tags(request):
ctype = request.GET.get('ctype')
term = request.GET.get('term')
- if oid and ctype :
+ if oid and ctype:
query = query.exclude(object_id=oid, content_type=ctype)
if term:
query = query.filter(tag__icontains=term)
- tags = query.values_list('tag', flat=True)
- return HttpResponse(json.dumps(list(tags)), content_type="application/javascript")
+ # DISTINCT ON fields is not supported by this database backend
+ tags = list()
+ [tags.append(x.tag) for x in query if x.tag not in tags]
+ return HttpResponse(json.dumps(tags), content_type="application/javascript")
def users(request):
object_list = User.objects.all()