This commit is contained in:
ChenFeng 2018-04-20 14:15:37 +00:00 committed by GitHub
commit aec3989fbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -286,10 +286,10 @@ class AutoSchema(ViewInspector):
elif model_field is not None and model_field.primary_key:
description = get_pk_description(model, model_field)
if hasattr(view, 'lookup_value_regex') and view.lookup_field == variable:
kwargs['pattern'] = view.lookup_value_regex
elif isinstance(model_field, models.AutoField):
if isinstance(model_field, (models.IntegerField, models.BigIntegerField, models.AutoField)):
schema_cls = coreschema.Integer
elif hasattr(view, 'lookup_value_regex') and view.lookup_field == variable:
kwargs['pattern'] = view.lookup_value_regex
field = coreapi.Field(
name=variable,