mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Do not check model_field's attributes if it is None
This commit is contained in:
parent
04315c12af
commit
ab5082d15c
|
@ -828,14 +828,14 @@ class ModelSerializer(Serializer):
|
|||
if model_field:
|
||||
kwargs['required'] = not(model_field.null or model_field.blank)
|
||||
|
||||
if not model_field.editable:
|
||||
kwargs['read_only'] = True
|
||||
if not model_field.editable:
|
||||
kwargs['read_only'] = True
|
||||
|
||||
if model_field.verbose_name is not None:
|
||||
kwargs['label'] = model_field.verbose_name
|
||||
if model_field.verbose_name is not None:
|
||||
kwargs['label'] = model_field.verbose_name
|
||||
|
||||
if model_field.help_text is not None:
|
||||
kwargs['help_text'] = model_field.help_text
|
||||
if model_field.help_text is not None:
|
||||
kwargs['help_text'] = model_field.help_text
|
||||
|
||||
return PrimaryKeyRelatedField(**kwargs)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user