From patchwork Wed Jan 10 00:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 857857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zGVYT0bSzz9sBW for ; Wed, 10 Jan 2018 11:41:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="hvPzGnOZ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zGVYS6P0szF0RJ for ; Wed, 10 Jan 2018 11:41:00 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="hvPzGnOZ"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=23.83.209.62; helo=fossa.birch.relay.mailchannels.net; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="hvPzGnOZ"; dkim-atps=neutral Received: from fossa.birch.relay.mailchannels.net (fossa.birch.relay.mailchannels.net [23.83.209.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zGVY10h3JzF0Qy for ; Wed, 10 Jan 2018 11:40:36 +1100 (AEDT) X-Sender-Id: mxroute|x-authuser|stephen@that.guru Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E1EC23E0B22 for ; Wed, 10 Jan 2018 00:40:33 +0000 (UTC) Received: from one.mxroute.com (unknown [100.96.25.19]) (Authenticated sender: mxroute) by relay.mailchannels.net (Postfix) with ESMTPA id 7543B3E11C6 for ; Wed, 10 Jan 2018 00:40:33 +0000 (UTC) X-Sender-Id: mxroute|x-authuser|stephen@that.guru Received: from one.mxroute.com (one-outgoing.mxroute.com [172.18.63.190]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.11.3); Wed, 10 Jan 2018 00:40:33 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: mxroute|x-authuser|stephen@that.guru X-MailChannels-Auth-Id: mxroute X-Shoe-Lettuce: 3851e65b27067531_1515544833694_2226220542 X-MC-Loop-Signature: 1515544833694:3593001621 X-MC-Ingress-Time: 1515544833694 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ImQS9+d0Kay049Vvbf2S8ym0+tkwKyl7Y3qcKZzqMGs=; b=hvPzGnOZfLNeyveKa5WWIuCMLt Wxz6R3JB40ILgVFHHgcElVVaE21XUh2W3igFELKbEEr7SAQm1EQ9e6BWsjbiCSRySEHnRKyV3BLd7 I6qYci8EE9tW7v94SvYVunxPq8CVIFAPSk6xfg5cB1UN+dQ2l40Fyazhm4Es6oZYqESoNRZV0aF4z TGEOkRnQFlgTS5a954f6QcSs5BHNigrUVqyn78fTXyO9Be6W3FIDsg74xCFAIuEeGreL2OlBQnS1W w2jK+KnyKm4PxYEnbIm3wnxGCcARxmWwfw7KO32Qn3N8CmgWZHZpAnXR4sRoboq5t//lLnKk1K7rq GnZiTBGw==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [RFC 4/4] REST: Only fetch required fields event filtering Date: Wed, 10 Jan 2018 00:40:24 +0000 Message-Id: <20180110004024.5551-5-stephen@that.guru> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180110004024.5551-1-stephen@that.guru> References: <20180110004024.5551-1-stephen@that.guru> X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The filter widget is pretty dumb, containing a full list of every patch in the system. We will want to rework this in the future, but for now just minimize the amount of data we're pulling in. Signed-off-by: Stephen Finucane --- patchwork/api/filters.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/patchwork/api/filters.py b/patchwork/api/filters.py index d207b2b6..ab6d6f55 100644 --- a/patchwork/api/filters.py +++ b/patchwork/api/filters.py @@ -174,6 +174,13 @@ class CheckFilter(TimestampMixin, FilterSet): class EventFilter(ProjectMixin, TimestampMixin, FilterSet): + patch = ModelChoiceFilter(queryset=Patch.objects.only('pk', 'name')) + series = ModelChoiceFilter(queryset=Series.objects.only('pk', 'name')) + cover = ModelChoiceFilter(queryset=CoverLetter.objects.only('pk', 'name')) + + def filter_patch(self, queryset, name, value): + return queryset.only('pk', 'name') + class Meta: model = Event fields = ('project', 'category', 'series', 'patch', 'cover')