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
8e9cb1e6
Commit
8e9cb1e6
authored
Mar 22, 2017
by
Tom Christie
Committed by
GitHub
Mar 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5014 from dczech/feature/decouple-bigautofield
Include URL path regexs in API schemas where valid.
parents
7d64cf56
54d0901f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
rest_framework/schemas.py
+5
-2
No files found.
rest_framework/schemas.py
View file @
8e9cb1e6
...
@@ -526,6 +526,7 @@ class SchemaGenerator(object):
...
@@ -526,6 +526,7 @@ class SchemaGenerator(object):
title
=
''
title
=
''
description
=
''
description
=
''
schema_cls
=
coreschema
.
String
schema_cls
=
coreschema
.
String
kwargs
=
{}
if
model
is
not
None
:
if
model
is
not
None
:
# Attempt to infer a field description if possible.
# Attempt to infer a field description if possible.
try
:
try
:
...
@@ -541,14 +542,16 @@ class SchemaGenerator(object):
...
@@ -541,14 +542,16 @@ class SchemaGenerator(object):
elif
model_field
is
not
None
and
model_field
.
primary_key
:
elif
model_field
is
not
None
and
model_field
.
primary_key
:
description
=
get_pk_description
(
model
,
model_field
)
description
=
get_pk_description
(
model
,
model_field
)
if
isinstance
(
model_field
,
models
.
AutoField
):
if
hasattr
(
view
,
'lookup_value_regex'
)
and
view
.
lookup_field
==
variable
:
kwargs
[
'pattern'
]
=
view
.
lookup_value_regex
elif
isinstance
(
model_field
,
models
.
AutoField
):
schema_cls
=
coreschema
.
Integer
schema_cls
=
coreschema
.
Integer
field
=
coreapi
.
Field
(
field
=
coreapi
.
Field
(
name
=
variable
,
name
=
variable
,
location
=
'path'
,
location
=
'path'
,
required
=
True
,
required
=
True
,
schema
=
schema_cls
(
title
=
title
,
description
=
description
)
schema
=
schema_cls
(
title
=
title
,
description
=
description
,
**
kwargs
)
)
)
fields
.
append
(
field
)
fields
.
append
(
field
)
...
...
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