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
63d02dbe
Commit
63d02dbe
authored
Aug 19, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop six from compat. 1.4.2 is now the lowest supported version.
parent
00c0dfc6
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
31 additions
and
39 deletions
+31
-39
README.md
+1
-1
docs/index.md
+1
-1
docs/topics/2.4-accouncement.md
+0
-1
rest_framework/compat.py
+1
-6
rest_framework/decorators.py
+1
-1
rest_framework/fields.py
+2
-2
rest_framework/filters.py
+2
-1
rest_framework/parsers.py
+2
-1
rest_framework/renderers.py
+2
-4
rest_framework/response.py
+1
-1
rest_framework/serializers.py
+1
-1
rest_framework/settings.py
+1
-4
rest_framework/templatetags/rest_framework.py
+2
-1
rest_framework/test.py
+2
-1
tests/test_authentication.py
+1
-2
tests/test_files.py
+1
-1
tests/test_generics.py
+1
-1
tests/test_htmlrenderer.py
+2
-2
tests/test_relations_pk.py
+1
-1
tests/test_renderers.py
+2
-2
tests/test_request.py
+1
-1
tests/test_response.py
+1
-1
tests/test_serializers.py
+1
-1
tests/utils.py
+1
-1
No files found.
README.md
View file @
63d02dbe
...
@@ -27,7 +27,7 @@ There is a live example API for testing purposes, [available here][sandbox].
...
@@ -27,7 +27,7 @@ There is a live example API for testing purposes, [available here][sandbox].
# Requirements
# Requirements
*
Python (2.6.5+, 2.7, 3.2, 3.3)
*
Python (2.6.5+, 2.7, 3.2, 3.3)
*
Django (1.
3, 1.4, 1.5, 1.6
)
*
Django (1.
4.2+, 1.5, 1.6, 1.7
)
# Installation
# Installation
...
...
docs/index.md
View file @
63d02dbe
...
@@ -50,7 +50,7 @@ Some reasons you might want to use REST framework:
...
@@ -50,7 +50,7 @@ Some reasons you might want to use REST framework:
REST framework requires the following:
REST framework requires the following:
*
Python (2.6.5+, 2.7, 3.2, 3.3)
*
Python (2.6.5+, 2.7, 3.2, 3.3)
*
Django (1.
3, 1.4, 1.5, 1.6
)
*
Django (1.
4.2+, 1.5, 1.6, 1.7
)
The following packages are optional:
The following packages are optional:
...
...
docs/topics/2.4-accouncement.md
View file @
63d02dbe
*
Writable nested serializers.
*
List/detail routes.
*
List/detail routes.
*
1.3 Support dropped, install six for <=1.4.?.
*
1.3 Support dropped, install six for <=1.4.?.
*
`allow_none`
for char fields
*
`allow_none`
for char fields
...
...
rest_framework/compat.py
View file @
63d02dbe
...
@@ -9,14 +9,9 @@ import django
...
@@ -9,14 +9,9 @@ import django
import
inspect
import
inspect
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.exceptions
import
ImproperlyConfigured
from
django.conf
import
settings
from
django.conf
import
settings
from
django.utils
import
six
# Try to import six from Django, fallback to external `six` package.
try
:
from
django.utils
import
six
except
ImportError
:
import
six
# Handle django.utils.encoding rename in 1.5 onwards.
# Handle django.utils.encoding rename in 1.5 onwards.
# smart_unicode -> smart_text
# smart_unicode -> smart_text
# force_unicode -> force_text
# force_unicode -> force_text
...
...
rest_framework/decorators.py
View file @
63d02dbe
...
@@ -7,7 +7,7 @@ based views, as well as the `@detail_route` and `@list_route` decorators, which
...
@@ -7,7 +7,7 @@ based views, as well as the `@detail_route` and `@list_route` decorators, which
used to annotate methods on viewsets that should be included by routers.
used to annotate methods on viewsets that should be included by routers.
"""
"""
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
rest_framework.compat
import
six
from
django.utils
import
six
from
rest_framework.views
import
APIView
from
rest_framework.views
import
APIView
import
types
import
types
import
warnings
import
warnings
...
...
rest_framework/fields.py
View file @
63d02dbe
...
@@ -18,14 +18,14 @@ from django.conf import settings
...
@@ -18,14 +18,14 @@ from django.conf import settings
from
django.db.models.fields
import
BLANK_CHOICE_DASH
from
django.db.models.fields
import
BLANK_CHOICE_DASH
from
django.http
import
QueryDict
from
django.http
import
QueryDict
from
django.forms
import
widgets
from
django.forms
import
widgets
from
django.utils
import
timezone
from
django.utils
import
six
,
timezone
from
django.utils.encoding
import
is_protected_type
from
django.utils.encoding
import
is_protected_type
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.datastructures
import
SortedDict
from
django.utils.datastructures
import
SortedDict
from
django.utils.dateparse
import
parse_date
,
parse_datetime
,
parse_time
from
django.utils.dateparse
import
parse_date
,
parse_datetime
,
parse_time
from
rest_framework
import
ISO_8601
from
rest_framework
import
ISO_8601
from
rest_framework.compat
import
(
from
rest_framework.compat
import
(
BytesIO
,
s
ix
,
s
mart_text
,
BytesIO
,
smart_text
,
force_text
,
is_non_str_iterable
force_text
,
is_non_str_iterable
)
)
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
...
...
rest_framework/filters.py
View file @
63d02dbe
...
@@ -5,7 +5,8 @@ returned by list views.
...
@@ -5,7 +5,8 @@ returned by list views.
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.exceptions
import
ImproperlyConfigured
from
django.db
import
models
from
django.db
import
models
from
rest_framework.compat
import
django_filters
,
six
,
guardian
,
get_model_name
from
django.utils
import
six
from
rest_framework.compat
import
django_filters
,
guardian
,
get_model_name
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
from
functools
import
reduce
from
functools
import
reduce
import
operator
import
operator
...
...
rest_framework/parsers.py
View file @
63d02dbe
...
@@ -10,7 +10,8 @@ from django.core.files.uploadhandler import StopFutureHandlers
...
@@ -10,7 +10,8 @@ from django.core.files.uploadhandler import StopFutureHandlers
from
django.http
import
QueryDict
from
django.http
import
QueryDict
from
django.http.multipartparser
import
MultiPartParser
as
DjangoMultiPartParser
from
django.http.multipartparser
import
MultiPartParser
as
DjangoMultiPartParser
from
django.http.multipartparser
import
MultiPartParserError
,
parse_header
,
ChunkIter
from
django.http.multipartparser
import
MultiPartParserError
,
parse_header
,
ChunkIter
from
rest_framework.compat
import
etree
,
six
,
yaml
,
force_text
from
django.utils
import
six
from
rest_framework.compat
import
etree
,
yaml
,
force_text
from
rest_framework.exceptions
import
ParseError
from
rest_framework.exceptions
import
ParseError
from
rest_framework
import
renderers
from
rest_framework
import
renderers
import
json
import
json
...
...
rest_framework/renderers.py
View file @
63d02dbe
...
@@ -15,11 +15,9 @@ from django.core.exceptions import ImproperlyConfigured
...
@@ -15,11 +15,9 @@ from django.core.exceptions import ImproperlyConfigured
from
django.http.multipartparser
import
parse_header
from
django.http.multipartparser
import
parse_header
from
django.template
import
RequestContext
,
loader
,
Template
from
django.template
import
RequestContext
,
loader
,
Template
from
django.test.client
import
encode_multipart
from
django.test.client
import
encode_multipart
from
django.utils
import
six
from
django.utils.xmlutils
import
SimplerXMLGenerator
from
django.utils.xmlutils
import
SimplerXMLGenerator
from
rest_framework.compat
import
StringIO
from
rest_framework.compat
import
StringIO
,
smart_text
,
yaml
from
rest_framework.compat
import
six
from
rest_framework.compat
import
smart_text
from
rest_framework.compat
import
yaml
from
rest_framework.exceptions
import
ParseError
from
rest_framework.exceptions
import
ParseError
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
from
rest_framework.request
import
is_form_media_type
,
override_method
from
rest_framework.request
import
is_form_media_type
,
override_method
...
...
rest_framework/response.py
View file @
63d02dbe
...
@@ -8,7 +8,7 @@ from __future__ import unicode_literals
...
@@ -8,7 +8,7 @@ from __future__ import unicode_literals
import
django
import
django
from
django.core.handlers.wsgi
import
STATUS_CODE_TEXT
from
django.core.handlers.wsgi
import
STATUS_CODE_TEXT
from
django.template.response
import
SimpleTemplateResponse
from
django.template.response
import
SimpleTemplateResponse
from
rest_framework.compat
import
six
from
django.utils
import
six
class
Response
(
SimpleTemplateResponse
):
class
Response
(
SimpleTemplateResponse
):
...
...
rest_framework/serializers.py
View file @
63d02dbe
...
@@ -20,9 +20,9 @@ from django.contrib.contenttypes.generic import GenericForeignKey
...
@@ -20,9 +20,9 @@ from django.contrib.contenttypes.generic import GenericForeignKey
from
django.core.paginator
import
Page
from
django.core.paginator
import
Page
from
django.db
import
models
from
django.db
import
models
from
django.forms
import
widgets
from
django.forms
import
widgets
from
django.utils
import
six
from
django.utils.datastructures
import
SortedDict
from
django.utils.datastructures
import
SortedDict
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.core.exceptions
import
ObjectDoesNotExist
from
rest_framework.compat
import
six
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
...
...
rest_framework/settings.py
View file @
63d02dbe
...
@@ -18,12 +18,9 @@ REST framework settings, checking for user settings first, then falling
...
@@ -18,12 +18,9 @@ REST framework settings, checking for user settings first, then falling
back to the defaults.
back to the defaults.
"""
"""
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.conf
import
settings
from
django.utils
import
importlib
from
django.utils
import
importlib
,
six
from
rest_framework
import
ISO_8601
from
rest_framework
import
ISO_8601
from
rest_framework.compat
import
six
USER_SETTINGS
=
getattr
(
settings
,
'REST_FRAMEWORK'
,
None
)
USER_SETTINGS
=
getattr
(
settings
,
'REST_FRAMEWORK'
,
None
)
...
...
rest_framework/templatetags/rest_framework.py
View file @
63d02dbe
...
@@ -2,11 +2,12 @@ from __future__ import unicode_literals, absolute_import
...
@@ -2,11 +2,12 @@ from __future__ import unicode_literals, absolute_import
from
django
import
template
from
django
import
template
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
from
django.http
import
QueryDict
from
django.http
import
QueryDict
from
django.utils
import
six
from
django.utils.encoding
import
iri_to_uri
from
django.utils.encoding
import
iri_to_uri
from
django.utils.html
import
escape
from
django.utils.html
import
escape
from
django.utils.safestring
import
SafeData
,
mark_safe
from
django.utils.safestring
import
SafeData
,
mark_safe
from
rest_framework.compat
import
urlparse
,
force_text
,
six
from
django.utils.html
import
smart_urlquote
from
django.utils.html
import
smart_urlquote
from
rest_framework.compat
import
urlparse
,
force_text
import
re
import
re
register
=
template
.
Library
()
register
=
template
.
Library
()
...
...
rest_framework/test.py
View file @
63d02dbe
...
@@ -8,10 +8,11 @@ from django.conf import settings
...
@@ -8,10 +8,11 @@ from django.conf import settings
from
django.test.client
import
Client
as
DjangoClient
from
django.test.client
import
Client
as
DjangoClient
from
django.test.client
import
ClientHandler
from
django.test.client
import
ClientHandler
from
django.test
import
testcases
from
django.test
import
testcases
from
django.utils
import
six
from
django.utils.http
import
urlencode
from
django.utils.http
import
urlencode
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
from
rest_framework.compat
import
RequestFactory
as
DjangoRequestFactory
from
rest_framework.compat
import
RequestFactory
as
DjangoRequestFactory
from
rest_framework.compat
import
force_bytes_or_smart_bytes
,
six
from
rest_framework.compat
import
force_bytes_or_smart_bytes
def
force_authenticate
(
request
,
user
=
None
,
token
=
None
):
def
force_authenticate
(
request
,
user
=
None
,
token
=
None
):
...
...
tests/test_authentication.py
View file @
63d02dbe
...
@@ -3,7 +3,7 @@ from django.conf.urls import patterns, url, include
...
@@ -3,7 +3,7 @@ from django.conf.urls import patterns, url, include
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils
import
unittest
from
django.utils
import
six
,
unittest
from
django.utils.http
import
urlencode
from
django.utils.http
import
urlencode
from
rest_framework
import
HTTP_HEADER_ENCODING
from
rest_framework
import
HTTP_HEADER_ENCODING
from
rest_framework
import
exceptions
from
rest_framework
import
exceptions
...
@@ -20,7 +20,6 @@ from rest_framework.authentication import (
...
@@ -20,7 +20,6 @@ from rest_framework.authentication import (
OAuth2Authentication
OAuth2Authentication
)
)
from
rest_framework.authtoken.models
import
Token
from
rest_framework.authtoken.models
import
Token
from
rest_framework.compat
import
six
from
rest_framework.compat
import
oauth2_provider
,
oauth2_provider_scope
from
rest_framework.compat
import
oauth2_provider
,
oauth2_provider_scope
from
rest_framework.compat
import
oauth
,
oauth_provider
from
rest_framework.compat
import
oauth
,
oauth_provider
from
rest_framework.test
import
APIRequestFactory
,
APIClient
from
rest_framework.test
import
APIRequestFactory
,
APIClient
...
...
tests/test_files.py
View file @
63d02dbe
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils
import
six
from
rest_framework
import
serializers
from
rest_framework
import
serializers
from
rest_framework.compat
import
BytesIO
from
rest_framework.compat
import
BytesIO
from
rest_framework.compat
import
six
import
datetime
import
datetime
...
...
tests/test_generics.py
View file @
63d02dbe
...
@@ -2,11 +2,11 @@ from __future__ import unicode_literals
...
@@ -2,11 +2,11 @@ from __future__ import unicode_literals
from
django.db
import
models
from
django.db
import
models
from
django.shortcuts
import
get_object_or_404
from
django.shortcuts
import
get_object_or_404
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils
import
six
from
rest_framework
import
generics
,
renderers
,
serializers
,
status
from
rest_framework
import
generics
,
renderers
,
serializers
,
status
from
rest_framework.test
import
APIRequestFactory
from
rest_framework.test
import
APIRequestFactory
from
tests.models
import
BasicModel
,
Comment
,
SlugBasedModel
from
tests.models
import
BasicModel
,
Comment
,
SlugBasedModel
from
tests.models
import
ForeignKeySource
,
ForeignKeyTarget
from
tests.models
import
ForeignKeySource
,
ForeignKeyTarget
from
rest_framework.compat
import
six
factory
=
APIRequestFactory
()
factory
=
APIRequestFactory
()
...
...
tests/test_htmlrenderer.py
View file @
63d02dbe
...
@@ -4,12 +4,12 @@ from django.conf.urls import patterns, url
...
@@ -4,12 +4,12 @@ from django.conf.urls import patterns, url
from
django.http
import
Http404
from
django.http
import
Http404
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.template
import
TemplateDoesNotExist
,
Template
from
django.template
import
TemplateDoesNotExist
,
Template
import
django.template.loader
from
django.utils
import
six
from
rest_framework
import
status
from
rest_framework
import
status
from
rest_framework.decorators
import
api_view
,
renderer_classes
from
rest_framework.decorators
import
api_view
,
renderer_classes
from
rest_framework.renderers
import
TemplateHTMLRenderer
from
rest_framework.renderers
import
TemplateHTMLRenderer
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
from
rest_framework.compat
import
six
import
django.template.loader
@api_view
((
'GET'
,))
@api_view
((
'GET'
,))
...
...
tests/test_relations_pk.py
View file @
63d02dbe
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.db
import
models
from
django.db
import
models
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils
import
six
from
rest_framework
import
serializers
from
rest_framework
import
serializers
from
tests.models
import
(
from
tests.models
import
(
BlogPost
,
ManyToManyTarget
,
ManyToManySource
,
ForeignKeyTarget
,
ForeignKeySource
,
BlogPost
,
ManyToManyTarget
,
ManyToManySource
,
ForeignKeyTarget
,
ForeignKeySource
,
NullableForeignKeySource
,
OneToOneTarget
,
NullableOneToOneSource
,
NullableForeignKeySource
,
OneToOneTarget
,
NullableOneToOneSource
,
)
)
from
rest_framework.compat
import
six
# ManyToMany
# ManyToMany
...
...
tests/test_renderers.py
View file @
63d02dbe
...
@@ -6,10 +6,10 @@ from django.conf.urls import patterns, url, include
...
@@ -6,10 +6,10 @@ from django.conf.urls import patterns, url, include
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.db
import
models
from
django.db
import
models
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils
import
unittest
from
django.utils
import
six
,
unittest
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework
import
status
,
permissions
from
rest_framework
import
status
,
permissions
from
rest_framework.compat
import
yaml
,
etree
,
six
,
StringIO
from
rest_framework.compat
import
yaml
,
etree
,
StringIO
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
from
rest_framework.views
import
APIView
from
rest_framework.renderers
import
BaseRenderer
,
JSONRenderer
,
YAMLRenderer
,
\
from
rest_framework.renderers
import
BaseRenderer
,
JSONRenderer
,
YAMLRenderer
,
\
...
...
tests/test_request.py
View file @
63d02dbe
...
@@ -8,6 +8,7 @@ from django.contrib.auth import authenticate, login, logout
...
@@ -8,6 +8,7 @@ from django.contrib.auth import authenticate, login, logout
from
django.contrib.sessions.middleware
import
SessionMiddleware
from
django.contrib.sessions.middleware
import
SessionMiddleware
from
django.core.handlers.wsgi
import
WSGIRequest
from
django.core.handlers.wsgi
import
WSGIRequest
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils
import
six
from
rest_framework
import
status
from
rest_framework
import
status
from
rest_framework.authentication
import
SessionAuthentication
from
rest_framework.authentication
import
SessionAuthentication
from
rest_framework.parsers
import
(
from
rest_framework.parsers
import
(
...
@@ -21,7 +22,6 @@ from rest_framework.response import Response
...
@@ -21,7 +22,6 @@ from rest_framework.response import Response
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
from
rest_framework.test
import
APIRequestFactory
,
APIClient
from
rest_framework.test
import
APIRequestFactory
,
APIClient
from
rest_framework.views
import
APIView
from
rest_framework.views
import
APIView
from
rest_framework.compat
import
six
from
io
import
BytesIO
from
io
import
BytesIO
import
json
import
json
...
...
tests/test_response.py
View file @
63d02dbe
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.conf.urls
import
patterns
,
url
,
include
from
django.conf.urls
import
patterns
,
url
,
include
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils
import
six
from
tests.models
import
BasicModel
,
BasicModelSerializer
from
tests.models
import
BasicModel
,
BasicModelSerializer
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
from
rest_framework.views
import
APIView
...
@@ -14,7 +15,6 @@ from rest_framework.renderers import (
...
@@ -14,7 +15,6 @@ from rest_framework.renderers import (
)
)
from
rest_framework
import
viewsets
from
rest_framework
import
viewsets
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
from
rest_framework.compat
import
six
class
MockPickleRenderer
(
BaseRenderer
):
class
MockPickleRenderer
(
BaseRenderer
):
...
...
tests/test_serializers.py
View file @
63d02dbe
from
django.test
import
TestCase
from
django.test
import
TestCase
from
rest_framework.compat
import
six
from
django.utils
import
six
from
rest_framework.serializers
import
_resolve_model
from
rest_framework.serializers
import
_resolve_model
from
tests.models
import
BasicModel
from
tests.models
import
BasicModel
...
...
tests/utils.py
View file @
63d02dbe
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
rest_framework.compat
import
six
from
django.utils
import
six
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
...
...
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