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
dbd23521
Commit
dbd23521
authored
Feb 17, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for latest pep8 updates. Refs #2563.
parent
76fe710c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
17 deletions
+19
-17
rest_framework/renderers.py
+4
-4
rest_framework/request.py
+3
-3
rest_framework/serializers.py
+8
-6
rest_framework/templatetags/rest_framework.py
+2
-2
rest_framework/utils/model_meta.py
+2
-2
No files found.
rest_framework/renderers.py
View file @
dbd23521
...
...
@@ -458,8 +458,8 @@ class BrowsableAPIRenderer(BaseRenderer):
return
True
# Don't actually need to return a form
if
(
not
getattr
(
view
,
'get_serializer'
,
None
)
or
not
any
(
is_form_media_type
(
parser
.
media_type
)
for
parser
in
view
.
parser_classes
)
not
getattr
(
view
,
'get_serializer'
,
None
)
or
not
any
(
is_form_media_type
(
parser
.
media_type
)
for
parser
in
view
.
parser_classes
)
):
return
...
...
@@ -503,8 +503,8 @@ class BrowsableAPIRenderer(BaseRenderer):
# If we're not using content overloading there's no point in
# supplying a generic form, as the view won't treat the form's
# value as the content of the request.
if
not
(
api_settings
.
FORM_CONTENT_OVERRIDE
a
nd
a
pi_settings
.
FORM_CONTENTTYPE_OVERRIDE
):
if
not
(
api_settings
.
FORM_CONTENT_OVERRIDE
and
api_settings
.
FORM_CONTENTTYPE_OVERRIDE
):
return
None
# Check permissions
...
...
rest_framework/request.py
View file @
dbd23521
...
...
@@ -383,9 +383,9 @@ class Request(object):
# We only need to use form overloading on form POST requests.
if
(
not
USE_FORM_OVERLOADING
or
self
.
_request
.
method
!=
'POST'
or
not
is_form_media_type
(
self
.
_content_type
)
self
.
_request
.
method
!=
'POST'
or
not
USE_FORM_OVERLOADING
or
not
is_form_media_type
(
self
.
_content_type
)
):
return
...
...
rest_framework/serializers.py
View file @
dbd23521
...
...
@@ -336,8 +336,8 @@ class Serializer(BaseSerializer):
return
OrderedDict
([
(
field_name
,
field
.
get_value
(
self
.
initial_data
))
for
field_name
,
field
in
self
.
fields
.
items
()
if
field
.
get_value
(
self
.
initial_data
)
is
not
empty
and
not
field
.
read_only
if
(
field
.
get_value
(
self
.
initial_data
)
is
not
empty
)
and
not
field
.
read_only
])
return
OrderedDict
([
...
...
@@ -653,8 +653,9 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
# ...
# profile = ProfileSerializer()
assert
not
any
(
isinstance
(
field
,
BaseSerializer
)
and
(
key
in
validated_data
)
and
isinstance
(
validated_data
[
key
],
(
list
,
dict
))
isinstance
(
field
,
BaseSerializer
)
and
(
key
in
validated_data
)
and
isinstance
(
validated_data
[
key
],
(
list
,
dict
))
for
key
,
field
in
serializer
.
fields
.
items
()
),
(
'The `.{method_name}()` method does not support writable nested'
...
...
@@ -673,8 +674,9 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
# ...
# address = serializer.CharField('profile.address')
assert
not
any
(
'.'
in
field
.
source
and
(
key
in
validated_data
)
and
isinstance
(
validated_data
[
key
],
(
list
,
dict
))
'.'
in
field
.
source
and
(
key
in
validated_data
)
and
isinstance
(
validated_data
[
key
],
(
list
,
dict
))
for
key
,
field
in
serializer
.
fields
.
items
()
),
(
'The `.{method_name}()` method does not support writable dotted-source '
...
...
rest_framework/templatetags/rest_framework.py
View file @
dbd23521
...
...
@@ -162,8 +162,8 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru
lead
=
lead
+
opening
# Keep parentheses at the end only if they're balanced.
if
(
middle
.
endswith
(
closing
)
and
middle
.
count
(
closing
)
==
middle
.
count
(
opening
)
+
1
middle
.
endswith
(
closing
)
and
middle
.
count
(
closing
)
==
middle
.
count
(
opening
)
+
1
):
middle
=
middle
[:
-
len
(
closing
)]
trail
=
closing
+
trail
...
...
rest_framework/utils/model_meta.py
View file @
dbd23521
...
...
@@ -145,8 +145,8 @@ def _get_reverse_relationships(opts):
related_model
=
related
,
to_many
=
True
,
has_through_model
=
(
(
getattr
(
relation
.
field
.
rel
,
'through'
,
None
)
is
not
None
)
and
not
relation
.
field
.
rel
.
through
.
_meta
.
auto_created
(
getattr
(
relation
.
field
.
rel
,
'through'
,
None
)
is
not
None
)
and
not
relation
.
field
.
rel
.
through
.
_meta
.
auto_created
)
)
...
...
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