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
54d0901f
Commit
54d0901f
authored
Mar 21, 2017
by
Dariusz Czech
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Leave parameters with regex pattern as String
parent
9074e3e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
rest_framework/schemas.py
+5
-3
No files found.
rest_framework/schemas.py
View file @
54d0901f
...
...
@@ -526,6 +526,7 @@ class SchemaGenerator(object):
title
=
''
description
=
''
schema_cls
=
coreschema
.
String
kwargs
=
{}
if
model
is
not
None
:
# Attempt to infer a field description if possible.
try
:
...
...
@@ -541,15 +542,16 @@ class SchemaGenerator(object):
elif
model_field
is
not
None
and
model_field
.
primary_key
:
description
=
get_pk_description
(
model
,
model_field
)
# BigAutoField is outside of Integer range
if
isinstance
(
model_field
,
models
.
AutoField
)
and
not
isinstance
(
model_field
,
models
.
BigAutoField
):
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
field
=
coreapi
.
Field
(
name
=
variable
,
location
=
'path'
,
required
=
True
,
schema
=
schema_cls
(
title
=
title
,
description
=
description
)
schema
=
schema_cls
(
title
=
title
,
description
=
description
,
**
kwargs
)
)
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