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
72c08115
Commit
72c08115
authored
Aug 29, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor tidy up.
parent
b3253b42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
rest_framework/generics.py
+8
-11
No files found.
rest_framework/generics.py
View file @
72c08115
...
@@ -3,7 +3,7 @@ Generic views that provide commonly needed behaviour.
...
@@ -3,7 +3,7 @@ Generic views that provide commonly needed behaviour.
"""
"""
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.core.exceptions
import
ImproperlyConfigured
,
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
django.core.paginator
import
Paginator
,
InvalidPage
from
django.core.paginator
import
Paginator
,
InvalidPage
from
django.http
import
Http404
from
django.http
import
Http404
from
django.shortcuts
import
get_object_or_404
as
_get_object_or_404
from
django.shortcuts
import
get_object_or_404
as
_get_object_or_404
...
@@ -235,19 +235,16 @@ class GenericAPIView(views.APIView):
...
@@ -235,19 +235,16 @@ class GenericAPIView(views.APIView):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
# Perform the lookup filtering.
# Perform the lookup filtering.
# Note that `pk` and `slug` are deprecated styles of lookup filtering.
lookup_url_kwarg
=
self
.
lookup_url_kwarg
or
self
.
lookup_field
lookup_url_kwarg
=
self
.
lookup_url_kwarg
or
self
.
lookup_field
lookup
=
self
.
kwargs
.
get
(
lookup_url_kwarg
,
None
)
if
lookup
is
None
:
assert
lookup_url_kwarg
in
self
.
kwargs
,
(
raise
ImproperlyConfigured
(
'Expected view
%
s to be called with a URL keyword argument '
'Expected view
%
s to be called with a URL keyword argument '
'named "
%
s". Fix your URL conf, or set the `.lookup_field` '
'named "
%
s". Fix your URL conf, or set the `.lookup_field` '
'attribute on the view correctly.'
%
'attribute on the view correctly.'
%
(
self
.
__class__
.
__name__
,
lookup_url_kwarg
)
(
self
.
__class__
.
__name__
,
self
.
lookup_field
)
)
)
filter_kwargs
=
{
self
.
lookup_field
:
lookup
}
filter_kwargs
=
{
self
.
lookup_field
:
self
.
kwargs
[
lookup_url_kwarg
]
}
obj
=
get_object_or_404
(
queryset
,
**
filter_kwargs
)
obj
=
get_object_or_404
(
queryset
,
**
filter_kwargs
)
# May raise a permission denied
# May raise a permission denied
...
...
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