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
44ff2e0a
Commit
44ff2e0a
authored
Nov 14, 2012
by
Stephan Groß
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some typos
parent
44e9749e
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
15 additions
and
15 deletions
+15
-15
rest_framework/compat.py
+1
-1
rest_framework/decorators.py
+1
-1
rest_framework/fields.py
+1
-1
rest_framework/renderers.py
+1
-1
rest_framework/response.py
+1
-1
rest_framework/serializers.py
+5
-5
rest_framework/settings.py
+1
-1
rest_framework/urlpatterns.py
+1
-1
rest_framework/urls.py
+2
-2
rest_framework/views.py
+1
-1
No files found.
rest_framework/compat.py
View file @
44ff2e0a
"""
The `compat` module provides support for backwards compatibility with older
versions of django/python, and compatbility wrappers around optional packages.
versions of django/python, and compat
i
bility wrappers around optional packages.
"""
# flake8: noqa
import
django
...
...
rest_framework/decorators.py
View file @
44ff2e0a
...
...
@@ -17,7 +17,7 @@ def api_view(http_method_names):
)
# Note, the above allows us to set the docstring.
# It is the equiv
e
lent of:
# It is the equiv
a
lent of:
#
# class WrappedAPIView(APIView):
# pass
...
...
rest_framework/fields.py
View file @
44ff2e0a
...
...
@@ -317,7 +317,7 @@ class RelatedField(WritableField):
choices
=
property
(
_get_choices
,
_set_choices
)
### Regular serializ
i
er stuff...
### Regular serializer stuff...
def
field_to_native
(
self
,
obj
,
field_name
):
value
=
getattr
(
obj
,
self
.
source
or
field_name
)
...
...
rest_framework/renderers.py
View file @
44ff2e0a
...
...
@@ -4,7 +4,7 @@ Renderers are used to serialize a response into specific media types.
They give us a generic way of being able to handle various media types
on the response, such as JSON encoded data or HTML output.
REST framework also provides an HTML renderer the renders the brows
e
able API.
REST framework also provides an HTML renderer the renders the browsable API.
"""
import
copy
import
string
...
...
rest_framework/response.py
View file @
44ff2e0a
...
...
@@ -15,7 +15,7 @@ class Response(SimpleTemplateResponse):
Alters the init arguments slightly.
For example, drop 'template_name', and instead use 'data'.
Setting 'renderer' and 'media_type' will typically be defered,
Setting 'renderer' and 'media_type' will typically be defer
r
ed,
For example being set automatically by the `APIView`.
"""
super
(
Response
,
self
)
.
__init__
(
None
,
status
=
status
)
...
...
rest_framework/serializers.py
View file @
44ff2e0a
...
...
@@ -89,7 +89,7 @@ class BaseSerializer(Field):
pass
_options_class
=
SerializerOptions
_dict_class
=
SortedDictWithMetadata
# Set to unsorted dict for backwards compat
a
bility with unsorted implementations.
_dict_class
=
SortedDictWithMetadata
# Set to unsorted dict for backwards compat
i
bility with unsorted implementations.
def
__init__
(
self
,
instance
=
None
,
data
=
None
,
context
=
None
,
**
kwargs
):
super
(
BaseSerializer
,
self
)
.
__init__
(
**
kwargs
)
...
...
@@ -163,7 +163,7 @@ class BaseSerializer(Field):
self
.
opts
.
depth
=
parent
.
opts
.
depth
-
1
#####
# Methods to convert or revert from objects <--> prim
a
tive representations.
# Methods to convert or revert from objects <--> prim
i
tive representations.
def
get_field_key
(
self
,
field_name
):
"""
...
...
@@ -244,7 +244,7 @@ class BaseSerializer(Field):
def
to_native
(
self
,
obj
):
"""
Serialize objects -> prim
a
tives.
Serialize objects -> prim
i
tives.
"""
if
hasattr
(
obj
,
'__iter__'
):
return
[
self
.
convert_object
(
item
)
for
item
in
obj
]
...
...
@@ -252,7 +252,7 @@ class BaseSerializer(Field):
def
from_native
(
self
,
data
):
"""
Deserialize prim
a
tives -> objects.
Deserialize prim
i
tives -> objects.
"""
if
hasattr
(
data
,
'__iter__'
)
and
not
isinstance
(
data
,
dict
):
# TODO: error data when deserializing lists
...
...
@@ -334,7 +334,7 @@ class ModelSerializer(Serializer):
"""
Return all the fields that should be serialized for the model.
"""
# TODO: Mod
fi
y this so that it's called on init, and drop
# TODO: Mod
if
y this so that it's called on init, and drop
# serialize/obj/data arguments.
#
# We *could* provide a hook for dynamic fields, but
...
...
rest_framework/settings.py
View file @
44ff2e0a
...
...
@@ -152,7 +152,7 @@ class APISettings(object):
def
validate_setting
(
self
,
attr
,
val
):
if
attr
==
'FILTER_BACKEND'
and
val
is
not
None
:
# Make sure we can initilize the class
# Make sure we can initi
a
lize the class
val
()
api_settings
=
APISettings
(
USER_SETTINGS
,
DEFAULTS
,
IMPORT_STRINGS
)
rest_framework/urlpatterns.py
View file @
44ff2e0a
...
...
@@ -4,7 +4,7 @@ from rest_framework.settings import api_settings
def
format_suffix_patterns
(
urlpatterns
,
suffix_required
=
False
,
allowed
=
None
):
"""
Supplement existing urlpatterns with corr
o
sponding patterns that also
Supplement existing urlpatterns with corr
e
sponding patterns that also
include a '.format' suffix. Retains urlpattern ordering.
urlpatterns:
...
...
rest_framework/urls.py
View file @
44ff2e0a
"""
Login and logout views for the brows
e
able API.
Login and logout views for the browsable API.
Add these to your root URLconf if you're using the brows
e
able API and
Add these to your root URLconf if you're using the browsable API and
your API requires authentication.
The urls must be namespaced as 'rest_framework', and you should make sure
...
...
rest_framework/views.py
View file @
44ff2e0a
...
...
@@ -140,7 +140,7 @@ class APIView(View):
def
http_method_not_allowed
(
self
,
request
,
*
args
,
**
kwargs
):
"""
Called if `request.method` does not corr
o
spond to a handler method.
Called if `request.method` does not corr
e
spond to a handler method.
"""
raise
exceptions
.
MethodNotAllowed
(
request
.
method
)
...
...
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