MCPcopy Create free account
hub / github.com/encode/django-rest-framework / needs_label

Function needs_label

rest_framework/utils/field_mapping.py:46–52  ·  view source on GitHub ↗

Returns `True` if the label based on the model's verbose name is not equal to the default label it would have based on it's field name.

(model_field, field_name)

Source from the content-addressed store, hash-verified

44
45
46def needs_label(model_field, field_name):
47 """
48 Returns `True` if the label based on the model's verbose name
49 is not equal to the default label it would have based on it's field name.
50 """
51 default_label = field_name.replace('_', ' ').capitalize()
52 return capfirst(model_field.verbose_name) != default_label
53
54
55def get_detail_view_name(model):

Callers 2

get_field_kwargsFunction · 0.85
get_relation_kwargsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected