@@ -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
}
});
}
@@ -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'] }
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- htdocs/js/patchwork.js | 9 +++++---- patchwork/views/api.py | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-)