From patchwork Thu Sep 6 22:02:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 11217 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2327E23F9F for ; Thu, 6 Sep 2012 22:02:14 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 74F3AA18C92 for ; Thu, 6 Sep 2012 22:01:16 +0000 (UTC) Received: by iafj25 with SMTP id j25so2361754iaf.11 for ; Thu, 06 Sep 2012 15:02:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=yZeuq4EPb9OXMCrcJqR+ibaNCTkOuFS3tHCRT26eAYY=; b=a7LLqNToLMBisuq6cpjYnFEIKew2A8udnHSBdAZJbJ5McQz7fsRwV6yNazBJQ+E7Ya seuhxZaiupPi1x77O7CfR3dWaXkVyVypJKG2E5O2cWIATCLzu83WSFqDED/km0mee5rh Vr9Pb4VYwRmBT6srOp7Dfg/CYgYvOVSokCQIYyC9MNSTbjL1hJ3ihioNDliSNSyX4ojw 6DCLg4tn4lqZXC+yVxjZOyPpNv1jI4DEcumHyLheK5WpsZoP7r1r2q8M9LHHtF8dkAti /K2QXB9088auYbTAhpqOC0fIg1kzGI32Izz+bnZk13KX5mJ4zzslrWbPYKyEqogXsrYv HXuA== Received: by 10.50.191.227 with SMTP id hb3mr14934088igc.43.1346968933243; Thu, 06 Sep 2012 15:02:13 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp345364igc; Thu, 6 Sep 2012 15:02:12 -0700 (PDT) Received: by 10.180.91.1 with SMTP id ca1mr41871952wib.8.1346968931771; Thu, 06 Sep 2012 15:02:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id o16si8847771wiw.25.2012.09.06.15.02.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Sep 2012 15:02:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1T9k9L-0002wa-6X for ; Thu, 06 Sep 2012 22:02:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 1F368E050D for ; Thu, 6 Sep 2012 22:02:11 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dashboard X-Launchpad-Branch: ~linaro-validation/lava-dashboard/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 340 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dashboard/trunk] Rev 340: correctness and performance tweaks for filter attribute autocompletion Message-Id: <20120906220211.10991.32131.launchpad@ackee.canonical.com> Date: Thu, 06 Sep 2012 22:02:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15909"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: fe0355b611e387293c2d1138f52f0ed650a01a6b X-Gm-Message-State: ALoCoQmMbYgxmGARXyXCY0WD6n01cuuBdObCmKiQlqmvakwG/phXylS/6Rvt/dQ/i/v7fsnh8TYO ------------------------------------------------------------ revno: 340 committer: Michael Hudson-Doyle branch nick: trunk timestamp: Fri 2012-09-07 10:01:28 +1200 message: correctness and performance tweaks for filter attribute autocompletion modified: dashboard_app/views.py --- lp:lava-dashboard https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk You are subscribed to branch lp:lava-dashboard. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription === modified file 'dashboard_app/views.py' --- dashboard_app/views.py 2012-09-03 00:16:21 +0000 +++ dashboard_app/views.py 2012-09-06 22:01:28 +0000 @@ -26,6 +26,7 @@ from django.conf import settings from django.contrib.admin.widgets import FilteredSelectMultiple from django.contrib.auth.decorators import login_required +from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.core.exceptions import PermissionDenied, ValidationError from django.core.urlresolvers import reverse @@ -859,8 +860,10 @@ def filter_attr_name_completion_json(request): term = request.GET['term'] + content_type_id = ContentType.objects.get_for_model(TestRun).id result = NamedAttribute.objects.filter( - name__startswith=term).distinct('name').order_by('name').values_list('name', flat=True) + name__startswith=term, content_type_id=content_type_id + ).distinct().order_by('name').values_list('name', flat=True) return HttpResponse( json.dumps(list(result)), mimetype='application/json') @@ -869,9 +872,10 @@ def filter_attr_value_completion_json(request): name = request.GET['name'] term = request.GET['term'] + content_type_id = ContentType.objects.get_for_model(TestRun).id result = NamedAttribute.objects.filter( - name=name, - value__startswith=term).distinct('value').order_by('value').values_list('value', flat=True) + name=name, content_type_id=content_type_id, value__startswith=term + ).distinct().order_by('value').values_list('value', flat=True) return HttpResponse( json.dumps(list(result)), mimetype='application/json')