diff --git a/docs/changelog.rst b/docs/changelog.rst index 8f65af5f..6e3fd2a8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,6 +3,17 @@ Changelog ######### +********* +**1.0.6** +********* + +- **FIXED:** Swagger UI "Try it out!" should now work with Django login +- **FIXED:** callable ``default`` values on serializer fields will now be properly called (:pr:`24`, :issue:`25`) +- **IMPROVED:** updated ``swagger-ui`` to version 3.8.0 +- **IMPROVED:** ``PrimaryKeyRelatedField`` and ``SlugRelatedField`` will now have + appropriate types based on the related model (:pr:`26`) +- **IMPROVED:** mock views will now have a bound request even with ``public=False`` (:pr:`23`) + ********* **1.0.5** ********* diff --git a/src/drf_yasg/utils.py b/src/drf_yasg/utils.py index 01a2642e..81a78fdf 100644 --- a/src/drf_yasg/utils.py +++ b/src/drf_yasg/utils.py @@ -214,7 +214,7 @@ def inspect_model_field(model, model_field): if isinstance(model_field, model_field_class): swagger_type, format = tf break - else: + else: # pragma: no cover swagger_type, format = None, None if format is None or format == openapi.FORMAT_SLUG: @@ -274,7 +274,7 @@ def SwaggerType(existing_object=None, **instance_kwargs): if hasattr(default, 'set_context'): default.set_context(field) default = default() - except Exception as e: + except Exception as e: # pragma: no cover logger.warning("default for %s is callable but it raised an exception when " "called; 'default' field will not be added to schema", field, exc_info=True) default = None @@ -285,7 +285,7 @@ def SwaggerType(existing_object=None, **instance_kwargs): # JSON roundtrip ensures that the value is valid JSON; # for example, sets get transformed into lists default = json.loads(json.dumps(default, cls=encoders.JSONEncoder)) - except Exception: + except Exception: # pragma: no cover logger.warning("'default' on schema for %s will not be set because " "to_representation raised an exception", field, exc_info=True) default = None @@ -367,7 +367,7 @@ def make_schema_definition(): try: model = field.queryset.model pk_field = model._meta.pk - except Exception: + except Exception: # pragma: no cover logger.warning("an exception was raised when attempting to extract the primary key related to %s; " "falling back to plain string" % field, exc_info=True) else: