Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
work.w
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
30
Issues
30
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
osp
work.w
Commits
690e7f29
Commit
690e7f29
authored
Feb 07, 2018
by
alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sorting sorted out
parent
980536cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
11 deletions
+24
-11
playground/static/playground/js/collections.js
playground/static/playground/js/collections.js
+16
-0
playground/static/playground/js/views.js
playground/static/playground/js/views.js
+4
-10
playground/views.py
playground/views.py
+4
-1
No files found.
playground/static/playground/js/collections.js
View file @
690e7f29
...
...
@@ -18,6 +18,22 @@ window.W = window.W || {};
parseRecords
:
function
(
resp
,
options
)
{
return
resp
.
results
;
},
queryParams
:
{
currentPage
:
"
page
"
,
pageSize
:
"
page_size
"
,
totalRecords
:
"
count
"
,
// See <https://github.com/backbone-paginator/backbone.paginator/issues/264>
order
:
null
,
sortKey
:
"
ordering
"
,
ordering
:
function
()
{
var
sortKey
=
this
.
state
.
sortKey
,
order
=
this
.
state
.
order
;
if
(
sortKey
&&
order
!==
0
)
{
return
(
order
===
1
?
'
-
'
:
''
)
+
sortKey
;
}
return
null
;
}
}
});
...
...
playground/static/playground/js/views.js
View file @
690e7f29
...
...
@@ -1381,18 +1381,12 @@ window.W = window.W || {};
state
:
{
pageSize
:
25
,
firstPage
:
1
,
currentPage
:
1
},
queryParams
:
{
currentPage
:
"
page
"
,
pageSize
:
"
page_size
"
,
totalRecords
:
"
count
"
},
currentPage
:
1
,
sortKey
:
"
created_at
"
,
order
:
-
1
}
});
window
.
sc
=
scoreCollection
;
var
myListView
=
new
W
.
ListView
({
collection
:
scoreCollection
});
...
...
playground/views.py
View file @
690e7f29
...
...
@@ -2,6 +2,8 @@ from django.views.generic.base import TemplateView
from
rest_framework
import
viewsets
from
rest_framework.pagination
import
PageNumberPagination
from
rest_framework.parsers
import
FormParser
,
MultiPartParser
from
rest_framework.filters
import
OrderingFilter
# from django_filters.rest_framework import DjangoFilterBackend
from
.models
import
Attachment
,
Score
from
.serializers
import
AttachmentSerializer
,
ScoreSerializer
...
...
@@ -29,7 +31,8 @@ class ScoreViewSet(viewsets.ModelViewSet):
queryset
=
Score
.
objects
.
all
()
serializer_class
=
ScoreSerializer
pagination_class
=
ScoreViewSetPagination
filter_backends
=
(
OrderingFilter
,)
class
ScoreView
(
TemplateView
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment