mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 19:14:01 +03:00
fixed some typos
This commit is contained in:
parent
44e9749e36
commit
44ff2e0add
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
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 compatibility wrappers around optional packages.
|
||||
"""
|
||||
# flake8: noqa
|
||||
import django
|
||||
|
|
|
@ -17,7 +17,7 @@ def api_view(http_method_names):
|
|||
)
|
||||
|
||||
# Note, the above allows us to set the docstring.
|
||||
# It is the equivelent of:
|
||||
# It is the equivalent of:
|
||||
#
|
||||
# class WrappedAPIView(APIView):
|
||||
# pass
|
||||
|
|
|
@ -317,7 +317,7 @@ class RelatedField(WritableField):
|
|||
|
||||
choices = property(_get_choices, _set_choices)
|
||||
|
||||
### Regular serializier stuff...
|
||||
### Regular serializer stuff...
|
||||
|
||||
def field_to_native(self, obj, field_name):
|
||||
value = getattr(obj, self.source or field_name)
|
||||
|
|
|
@ -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 browseable API.
|
||||
REST framework also provides an HTML renderer the renders the browsable API.
|
||||
"""
|
||||
import copy
|
||||
import string
|
||||
|
|
|
@ -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 deferred,
|
||||
For example being set automatically by the `APIView`.
|
||||
"""
|
||||
super(Response, self).__init__(None, status=status)
|
||||
|
|
|
@ -89,7 +89,7 @@ class BaseSerializer(Field):
|
|||
pass
|
||||
|
||||
_options_class = SerializerOptions
|
||||
_dict_class = SortedDictWithMetadata # Set to unsorted dict for backwards compatability with unsorted implementations.
|
||||
_dict_class = SortedDictWithMetadata # Set to unsorted dict for backwards compatibility 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 <--> primative representations.
|
||||
# Methods to convert or revert from objects <--> primitive representations.
|
||||
|
||||
def get_field_key(self, field_name):
|
||||
"""
|
||||
|
@ -244,7 +244,7 @@ class BaseSerializer(Field):
|
|||
|
||||
def to_native(self, obj):
|
||||
"""
|
||||
Serialize objects -> primatives.
|
||||
Serialize objects -> primitives.
|
||||
"""
|
||||
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 primatives -> objects.
|
||||
Deserialize primitives -> 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: Modfiy this so that it's called on init, and drop
|
||||
# TODO: Modify this so that it's called on init, and drop
|
||||
# serialize/obj/data arguments.
|
||||
#
|
||||
# We *could* provide a hook for dynamic fields, but
|
||||
|
|
|
@ -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 initialize the class
|
||||
val()
|
||||
|
||||
api_settings = APISettings(USER_SETTINGS, DEFAULTS, IMPORT_STRINGS)
|
||||
|
|
|
@ -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 corrosponding patterns that also
|
||||
Supplement existing urlpatterns with corresponding patterns that also
|
||||
include a '.format' suffix. Retains urlpattern ordering.
|
||||
|
||||
urlpatterns:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Login and logout views for the browseable API.
|
||||
Login and logout views for the browsable API.
|
||||
|
||||
Add these to your root URLconf if you're using the browseable 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
|
||||
|
|
|
@ -140,7 +140,7 @@ class APIView(View):
|
|||
|
||||
def http_method_not_allowed(self, request, *args, **kwargs):
|
||||
"""
|
||||
Called if `request.method` does not corrospond to a handler method.
|
||||
Called if `request.method` does not correspond to a handler method.
|
||||
"""
|
||||
raise exceptions.MethodNotAllowed(request.method)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user