diff --git a/drf_openapi/entities.py b/drf_openapi/entities.py index 70bba2d..02385d6 100644 --- a/drf_openapi/entities.py +++ b/drf_openapi/entities.py @@ -5,7 +5,7 @@ import coreschema import uritemplate from coreapi import Link, Document, Field -from coreapi.compat import force_text +from django.utils.encoding import force_text from django.db import models from django.utils.functional import Promise from pkg_resources import parse_version @@ -252,12 +252,12 @@ def get_path_fields(self, path, method, view): except: model_field = None - if model_field is not None and model_field.verbose_name: + if model_field is not None and hasattr(model_field, 'verbose_name'): title = force_text(model_field.verbose_name) - if model_field is not None and model_field.help_text: + if model_field is not None and hasattr(model_field, 'help_text'): description = force_text(model_field.help_text) - elif model_field is not None and model_field.primary_key: + elif model_field is not None and hasattr(model_field, 'primary_key'): description = get_pk_description(model, model_field) if hasattr(view, 'lookup_value_regex') and view.lookup_field == variable: