From patchwork Fri Sep 11 15:55:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Lespiau X-Patchwork-Id: 516877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 316DD140271 for ; Sat, 12 Sep 2015 02:00:54 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 166431A2BD6 for ; Sat, 12 Sep 2015 02:00:54 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lists.ozlabs.org (Postfix) with ESMTP id 071531A2B43 for ; Sat, 12 Sep 2015 01:56:08 +1000 (AEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 11 Sep 2015 08:56:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,511,1437462000"; d="scan'208";a="559867278" Received: from jeffzhua-mobl.amr.corp.intel.com (HELO strange.amr.corp.intel.com) ([10.254.88.85]) by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2015 08:56:07 -0700 From: Damien Lespiau To: patchwork@lists.ozlabs.org Subject: [PATCH 34/51] series: Enable sorting in the series list Date: Fri, 11 Sep 2015 16:55:07 +0100 Message-Id: <1441986924-26689-35-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1441986924-26689-1-git-send-email-damien.lespiau@intel.com> References: <1441986924-26689-1-git-send-email-damien.lespiau@intel.com> X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.20 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" Signed-off-by: Damien Lespiau --- htdocs/js/patchwork.js | 9 +++++---- patchwork/views/api.py | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/js/patchwork.js b/htdocs/js/patchwork.js index c1dfa6a..023de6a 100644 --- a/htdocs/js/patchwork.js +++ b/htdocs/js/patchwork.js @@ -25,8 +25,8 @@ var pw = (function() { var columnsMap = { 'Series': 'name', 'Patches': 'n_patches', - 'Submitter': 'submitter_name', - 'Reviewer': 'reviewer_name', + 'Submitter': 'submitter__name', + 'Reviewer': 'reviewer__name', 'Submitted': 'submitted', 'Updated': 'last_updated' }; @@ -67,7 +67,8 @@ var pw = (function() { perPage: 'perpage', records: 'results', queryRecordCount: 'count', - totalRecordCount: 'count' + totalRecordCount: 'count', + sorts: 'ordering' }, inputs: { pageText: '', @@ -79,7 +80,7 @@ var pw = (function() { 'name': series_writer, 'submitted': date_writer, 'last_updated': date_writer, - 'reviewer_name': reviewer_writer + 'reviewer__name': reviewer_writer } }); } diff --git a/patchwork/views/api.py b/patchwork/views/api.py index 95124fa..c3756fa 100644 --- a/patchwork/views/api.py +++ b/patchwork/views/api.py @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from patchwork.models import Project, Series, SeriesRevision -from rest_framework import viewsets, mixins, generics +from rest_framework import viewsets, mixins, generics, filters from rest_framework.response import Response from rest_framework.generics import get_object_or_404 from patchwork.serializers import ProjectSerializer, SeriesSerializer, \ @@ -44,6 +44,9 @@ class SeriesListViewSet(mixins.ListModelMixin, paginate_by = 20 paginate_by_param = 'perpage' max_paginate_by = 100 + filter_backends = (filters.OrderingFilter, ) + ordering_fields = ('name', 'n_patches', 'submitter__name', 'reviewer__name', + 'submitted', 'last_updated') def get_queryset(self): filter_kwargs = { 'project__linkname': self.kwargs['project_pk'] }