Skip to content

Commit

Permalink
Use getattr for 'help_text' (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaFox93 authored and axnsan12 committed Mar 31, 2019
1 parent 298a974 commit 81f0b1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/drf_yasg/inspectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def SwaggerType(existing_object=None, **instance_kwargs):
assert not isinstance(field, openapi.SwaggerDict), "passed field is already a SwaggerDict object"
title = force_real_str(field.label) if field.label else None
title = title if swagger_object_type == openapi.Schema else None # only Schema has title
description = force_real_str(field.help_text) if field.help_text else None
help_text = getattr(field, 'help_text', None)
description = force_real_str(help_text) if help_text else None
description = description if swagger_object_type != openapi.Items else None # Items has no description either

def SwaggerType(existing_object=None, **instance_kwargs):
Expand Down

0 comments on commit 81f0b1a

Please sign in to comment.