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
84e22cc2
Commit
84e22cc2
authored
May 30, 2017
by
Bekhzod Tillakhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scheme fix when unauth and Flask8 lint fix
parent
9c9525b1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
14 additions
and
2 deletions
+14
-2
rest_framework/templates/rest_framework/docs/document.html
+2
-1
rest_framework/templates/rest_framework/docs/sidebar.html
+2
-0
tests/test_atomic_requests.py
+1
-0
tests/test_fields.py
+0
-1
tests/test_permissions.py
+3
-0
tests/test_renderers.py
+1
-0
tests/test_request.py
+1
-0
tests/test_response.py
+1
-0
tests/test_reverse.py
+1
-0
tests/test_schemas.py
+1
-0
tests/test_validation.py
+1
-0
No files found.
rest_framework/templates/rest_framework/docs/document.html
View file @
84e22cc2
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
{% if 'javascript' in langs %}{% include "rest_framework/docs/langs/javascript-intro.html" %}{% endif %}
{% if 'javascript' in langs %}{% include "rest_framework/docs/langs/javascript-intro.html" %}{% endif %}
</div>
</div>
</div>
</div>
{% if document.data %}
{% for section_key, section in document.data|items %}
{% for section_key, section in document.data|items %}
{% if section_key %}
{% if section_key %}
<h2
id=
"{{ section_key }}"
class=
"coredocs-section-title"
>
{{ section_key }}
<a
href=
"#{{ section_key }}"
><i
class=
"fa fa-link"
aria-hidden=
"true"
></i>
<h2
id=
"{{ section_key }}"
class=
"coredocs-section-title"
>
{{ section_key }}
<a
href=
"#{{ section_key }}"
><i
class=
"fa fa-link"
aria-hidden=
"true"
></i>
...
@@ -28,3 +28,4 @@
...
@@ -28,3 +28,4 @@
{% for link_key, link in document.links|items %}
{% for link_key, link in document.links|items %}
{% include "rest_framework/docs/link.html" %}
{% include "rest_framework/docs/link.html" %}
{% endfor %}
{% endfor %}
{% endif %}
rest_framework/templates/rest_framework/docs/sidebar.html
View file @
84e22cc2
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<i
class=
"fa fa-bars fa-2x toggle-btn"
data-toggle=
"collapse"
data-target=
"#menu-content"
></i>
<i
class=
"fa fa-bars fa-2x toggle-btn"
data-toggle=
"collapse"
data-target=
"#menu-content"
></i>
<div
class=
"menu-list"
>
<div
class=
"menu-list"
>
<ul
id=
"menu-content"
class=
"menu-content collapse out"
>
<ul
id=
"menu-content"
class=
"menu-content collapse out"
>
{% if document.data %}
{% for section_key, section in document.data|items %}
{% for section_key, section in document.data|items %}
<li
data-toggle=
"collapse"
data-target=
"#{{ section_key }}-dropdown"
class=
"collapsed"
>
<li
data-toggle=
"collapse"
data-target=
"#{{ section_key }}-dropdown"
class=
"collapsed"
>
<a><i
class=
"fa fa-dot-circle-o fa-lg"
></i>
{% if section_key %}{{ section_key }}{% else %}API Endpoints{% endif %}
<span
class=
"arrow"
></span></a>
<a><i
class=
"fa fa-dot-circle-o fa-lg"
></i>
{% if section_key %}{{ section_key }}{% else %}API Endpoints{% endif %}
<span
class=
"arrow"
></span></a>
...
@@ -15,6 +16,7 @@
...
@@ -15,6 +16,7 @@
{% endfor %}
{% endfor %}
</ul>
</ul>
{% endfor %}
{% endfor %}
{% endif %}
</ul>
</ul>
<ul
class=
"menu-list menu-list-bottom"
>
<ul
class=
"menu-list menu-list-bottom"
>
...
...
tests/test_atomic_requests.py
View file @
84e22cc2
...
@@ -45,6 +45,7 @@ class NonAtomicAPIExceptionView(APIView):
...
@@ -45,6 +45,7 @@ class NonAtomicAPIExceptionView(APIView):
BasicModel
.
objects
.
all
()
BasicModel
.
objects
.
all
()
raise
Http404
raise
Http404
urlpatterns
=
(
urlpatterns
=
(
url
(
r'^$'
,
NonAtomicAPIExceptionView
.
as_view
()),
url
(
r'^$'
,
NonAtomicAPIExceptionView
.
as_view
()),
)
)
...
...
tests/test_fields.py
View file @
84e22cc2
...
@@ -1132,7 +1132,6 @@ class TestDateTimeField(FieldValues):
...
@@ -1132,7 +1132,6 @@ class TestDateTimeField(FieldValues):
valid_inputs
=
{
valid_inputs
=
{
'2001-01-01 13:00'
:
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
'2001-01-01 13:00'
:
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
'2001-01-01T13:00'
:
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
'2001-01-01T13:00'
:
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
'2001-01-01T13:00Z'
:
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
):
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
):
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
):
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
):
datetime
.
datetime
(
2001
,
1
,
1
,
13
,
00
,
tzinfo
=
utc
),
# Django 1.4 does not support timezone string parsing.
# Django 1.4 does not support timezone string parsing.
...
...
tests/test_permissions.py
View file @
84e22cc2
...
@@ -246,6 +246,7 @@ class ObjectPermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):
...
@@ -246,6 +246,7 @@ class ObjectPermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):
authentication_classes
=
[
authentication
.
BasicAuthentication
]
authentication_classes
=
[
authentication
.
BasicAuthentication
]
permission_classes
=
[
ViewObjectPermissions
]
permission_classes
=
[
ViewObjectPermissions
]
object_permissions_view
=
ObjectPermissionInstanceView
.
as_view
()
object_permissions_view
=
ObjectPermissionInstanceView
.
as_view
()
...
@@ -255,6 +256,7 @@ class ObjectPermissionListView(generics.ListAPIView):
...
@@ -255,6 +256,7 @@ class ObjectPermissionListView(generics.ListAPIView):
authentication_classes
=
[
authentication
.
BasicAuthentication
]
authentication_classes
=
[
authentication
.
BasicAuthentication
]
permission_classes
=
[
ViewObjectPermissions
]
permission_classes
=
[
ViewObjectPermissions
]
object_permissions_list_view
=
ObjectPermissionListView
.
as_view
()
object_permissions_list_view
=
ObjectPermissionListView
.
as_view
()
...
@@ -443,6 +445,7 @@ class DeniedObjectView(PermissionInstanceView):
...
@@ -443,6 +445,7 @@ class DeniedObjectView(PermissionInstanceView):
class
DeniedObjectViewWithDetail
(
PermissionInstanceView
):
class
DeniedObjectViewWithDetail
(
PermissionInstanceView
):
permission_classes
=
(
BasicObjectPermWithDetail
,)
permission_classes
=
(
BasicObjectPermWithDetail
,)
denied_view
=
DeniedView
.
as_view
()
denied_view
=
DeniedView
.
as_view
()
denied_view_with_detail
=
DeniedViewWithDetail
.
as_view
()
denied_view_with_detail
=
DeniedViewWithDetail
.
as_view
()
...
...
tests/test_renderers.py
View file @
84e22cc2
...
@@ -108,6 +108,7 @@ class HTMLView1(APIView):
...
@@ -108,6 +108,7 @@ class HTMLView1(APIView):
def
get
(
self
,
request
,
**
kwargs
):
def
get
(
self
,
request
,
**
kwargs
):
return
Response
(
'text'
)
return
Response
(
'text'
)
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^.*\.(?P<format>.+)$'
,
MockView
.
as_view
(
renderer_classes
=
[
RendererA
,
RendererB
])),
url
(
r'^.*\.(?P<format>.+)$'
,
MockView
.
as_view
(
renderer_classes
=
[
RendererA
,
RendererB
])),
url
(
r'^$'
,
MockView
.
as_view
(
renderer_classes
=
[
RendererA
,
RendererB
])),
url
(
r'^$'
,
MockView
.
as_view
(
renderer_classes
=
[
RendererA
,
RendererB
])),
...
...
tests/test_request.py
View file @
84e22cc2
...
@@ -120,6 +120,7 @@ class MockView(APIView):
...
@@ -120,6 +120,7 @@ class MockView(APIView):
return
Response
(
status
=
status
.
HTTP_500_INTERNAL_SERVER_ERROR
)
return
Response
(
status
=
status
.
HTTP_500_INTERNAL_SERVER_ERROR
)
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^$'
,
MockView
.
as_view
()),
url
(
r'^$'
,
MockView
.
as_view
()),
]
]
...
...
tests/test_response.py
View file @
84e22cc2
...
@@ -32,6 +32,7 @@ class MockJsonRenderer(BaseRenderer):
...
@@ -32,6 +32,7 @@ class MockJsonRenderer(BaseRenderer):
class
MockTextMediaRenderer
(
BaseRenderer
):
class
MockTextMediaRenderer
(
BaseRenderer
):
media_type
=
'text/html'
media_type
=
'text/html'
DUMMYSTATUS
=
status
.
HTTP_200_OK
DUMMYSTATUS
=
status
.
HTTP_200_OK
DUMMYCONTENT
=
'dummycontent'
DUMMYCONTENT
=
'dummycontent'
...
...
tests/test_reverse.py
View file @
84e22cc2
...
@@ -13,6 +13,7 @@ factory = APIRequestFactory()
...
@@ -13,6 +13,7 @@ factory = APIRequestFactory()
def
null_view
(
request
):
def
null_view
(
request
):
pass
pass
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^view$'
,
null_view
,
name
=
'view'
),
url
(
r'^view$'
,
null_view
,
name
=
'view'
),
]
]
...
...
tests/test_schemas.py
View file @
84e22cc2
...
@@ -70,6 +70,7 @@ class ExampleViewSet(ModelViewSet):
...
@@ -70,6 +70,7 @@ class ExampleViewSet(ModelViewSet):
assert
self
.
action
assert
self
.
action
return
super
(
ExampleViewSet
,
self
)
.
get_serializer
(
*
args
,
**
kwargs
)
return
super
(
ExampleViewSet
,
self
)
.
get_serializer
(
*
args
,
**
kwargs
)
if
coreapi
:
if
coreapi
:
schema_view
=
get_schema_view
(
title
=
'Example API'
)
schema_view
=
get_schema_view
(
title
=
'Example API'
)
else
:
else
:
...
...
tests/test_validation.py
View file @
84e22cc2
...
@@ -243,6 +243,7 @@ class RegexSerializer(serializers.Serializer):
...
@@ -243,6 +243,7 @@ class RegexSerializer(serializers.Serializer):
validators
=
[
RegexValidator
(
regex
=
re
.
compile
(
'^[0-9]{4,6}$'
),
validators
=
[
RegexValidator
(
regex
=
re
.
compile
(
'^[0-9]{4,6}$'
),
message
=
'A PIN is 4-6 digits'
)])
message
=
'A PIN is 4-6 digits'
)])
expected_repr
=
"""
expected_repr
=
"""
RegexSerializer():
RegexSerializer():
pin = CharField(validators=[<django.core.validators.RegexValidator object>])
pin = CharField(validators=[<django.core.validators.RegexValidator object>])
...
...
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