From patchwork Thu Sep 27 18:26:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 975851 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 ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Ljvg0GmXz9s1c for ; Fri, 28 Sep 2018 04:27:11 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru 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="NI0fjOk7"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42Ljvf5kqdzF38D for ; Fri, 28 Sep 2018 04:27:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru 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="NI0fjOk7"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=185.234.75.7; helo=relay-direct7.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru 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="NI0fjOk7"; dkim-atps=neutral Received: from relay-direct7.mxroute.com (relay-direct7.mxroute.com [185.234.75.7]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42Ljv65DKfzF37d for ; Fri, 28 Sep 2018 04:26:42 +1000 (AEST) Received: from filter002.mxroute.com (unknown [185.133.192.179]) by relay-direct6.mxroute.com (Postfix) with ESMTP id 49FCB3F0E2 for ; Thu, 27 Sep 2018 18:26:08 +0000 (UTC) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 25D663F0F5 for ; Thu, 27 Sep 2018 18:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CpoDr6gG+r1ZrhqECfbdiBe8ObZPxYHrLHjSjyNPcTM=; b=NI0fjOk7xp3p9+IOwLrzMo+ec5 IB7nj6Yl0lpXXhg8vzSIotUGw3Z6hrn9itDDy4bD76hTKzAFtsd0QKZTqkJHjrcsfjHNCKjRRpOKg KVfSpyvpfWrPFoML8Sg5bVbnBRrZ6YH7PkE0QNyMPOU3DxdLuO6Xkk17J91Af24PqkJVGbAKOKtrt tUeP/VN1p5HbOG5CazbE4cwRDJcSwiBE/CVWvf8XtYexpLzNwfyGO0GCrS0ihphJ/pR8mcaRBqaZa 9qc9Mn3XfpRXaoH4VbxB9e6mPoCq64GBXz29eyBLIBxhuMDBe9ltXJsk76rMd6dvquSp2oMWsU9Ud UuG0vQOA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 1/2] filters: Return dictionaries Date: Thu, 27 Sep 2018 19:26:00 +0100 Message-Id: <20180927182601.4676-1-stephen@that.guru> X-Mailer: git-send-email 2.17.1 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 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" This makes it a little easier to figure out what filters are active and will be used in a future patch. Signed-off-by: Stephen Finucane --- patchwork/filters.py | 7 +++---- patchwork/templates/patchwork/filters.html | 2 +- patchwork/views/__init__.py | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/patchwork/filters.py b/patchwork/filters.py index 6cfe41c9..75eaedd6 100644 --- a/patchwork/filters.py +++ b/patchwork/filters.py @@ -456,11 +456,10 @@ class Filters: return queryset.filter(**kwargs) def params(self): - return [(f.param, f.key()) for f in self._filters - if f.key() is not None] + return {f.param: f.key() for f in self._filters if f.key() is not None} def querystring(self, remove=None): - params = dict(self.params()) + params = self.params() for (k, v) in self.values.items(): if k not in params: @@ -481,7 +480,7 @@ class Filters: return self.querystring(filter) def applied_filters(self): - return [x for x in self._filters if x.applied] + return {x.param: x for x in self._filters if x.applied} def available_filters(self): return self._filters diff --git a/patchwork/templates/patchwork/filters.html b/patchwork/templates/patchwork/filters.html index 5331ac85..e760310b 100644 --- a/patchwork/templates/patchwork/filters.html +++ b/patchwork/templates/patchwork/filters.html @@ -130,7 +130,7 @@ $(document).ready(function() {
Show patches with: {% if filters.applied_filters %} - {% for filter in filters.applied_filters %} + {% for filter in filters.applied_filters.values %} {{ filter.name }} = {{ filter.condition }} {% if not filter.forced %}