diff --git a/src/drf_yasg/inspectors/base.py b/src/drf_yasg/inspectors/base.py index db2b19c1..9d9029ae 100644 --- a/src/drf_yasg/inspectors/base.py +++ b/src/drf_yasg/inspectors/base.py @@ -281,7 +281,8 @@ def SwaggerType(existing_object=None, use_field_title=True, **instance_kwargs): instance_kwargs.setdefault('title', title) if description is not None: instance_kwargs.setdefault('description', description) - if field.allow_null: + + if getattr(field, 'allow_null', None): instance_kwargs['x_nullable'] = True instance_kwargs.update(kwargs)