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
b3bbf416
Commit
b3bbf416
authored
Aug 29, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `allow_empty`
parent
0f8fdf4e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
15 deletions
+0
-15
rest_framework/mixins.py
+0
-15
No files found.
rest_framework/mixins.py
View file @
b3bbf416
...
...
@@ -70,24 +70,9 @@ class ListModelMixin(object):
"""
List a queryset.
"""
empty_error
=
"Empty list and '
%(class_name)
s.allow_empty' is False."
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object_list
=
self
.
filter_queryset
(
self
.
get_queryset
())
# Default is to allow empty querysets. This can be altered by setting
# `.allow_empty = False`, to raise 404 errors on empty querysets.
if
not
self
.
allow_empty
and
not
self
.
object_list
:
warnings
.
warn
(
'The `allow_empty` parameter is deprecated. '
'To use `allow_empty=False` style behavior, You should override '
'`get_queryset()` and explicitly raise a 404 on empty querysets.'
,
DeprecationWarning
)
class_name
=
self
.
__class__
.
__name__
error_msg
=
self
.
empty_error
%
{
'class_name'
:
class_name
}
raise
Http404
(
error_msg
)
# Switch between paginated or standard style responses
page
=
self
.
paginate_queryset
(
self
.
object_list
)
if
page
is
not
None
:
...
...
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