Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
dafda87a
Commit
dafda87a
authored
Jan 19, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #135 from bunchesofdonald/master
Add get_queryset method to ListModelMixin.
parents
0a5ca000
338e7783
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
djangorestframework/mixins.py
+5
-3
No files found.
djangorestframework/mixins.py
View file @
dafda87a
...
@@ -675,9 +675,7 @@ class ListModelMixin(ModelMixin):
...
@@ -675,9 +675,7 @@ class ListModelMixin(ModelMixin):
queryset
=
None
queryset
=
None
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
model
=
self
.
resource
.
model
queryset
=
self
.
get_queryset
()
queryset
=
self
.
queryset
if
self
.
queryset
is
not
None
else
model
.
objects
.
all
()
if
hasattr
(
self
,
'resource'
):
if
hasattr
(
self
,
'resource'
):
ordering
=
getattr
(
self
.
resource
,
'ordering'
,
None
)
ordering
=
getattr
(
self
.
resource
,
'ordering'
,
None
)
...
@@ -689,6 +687,10 @@ class ListModelMixin(ModelMixin):
...
@@ -689,6 +687,10 @@ class ListModelMixin(ModelMixin):
queryset
=
queryset
.
order_by
(
*
args
)
queryset
=
queryset
.
order_by
(
*
args
)
return
queryset
.
filter
(
self
.
build_query
(
**
kwargs
))
return
queryset
.
filter
(
self
.
build_query
(
**
kwargs
))
def
get_queryset
(
self
):
model
=
self
.
resource
.
model
return
model
.
objects
.
all
()
if
self
.
queryset
is
None
else
self
.
queryset
########## Pagination Mixins ##########
########## Pagination Mixins ##########
...
...
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