MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / __set_field_display

Method __set_field_display

mongoengine/base/document.py:1201–1211  ·  view source on GitHub ↗

For each field that specifies choices, create a get_ _display method.

(self)

Source from the content-addressed store, hash-verified

1199 return ".".join(parts)
1200
1201 def __set_field_display(self):
1202 """For each field that specifies choices, create a
1203 get_<field>_display method.
1204 """
1205 fields_with_choices = [(n, f) for n, f in self._fields.items() if f.choices]
1206 for attr_name, field in fields_with_choices:
1207 setattr(
1208 self,
1209 "get_%s_display" % attr_name,
1210 partial(self.__get_field_display, field=field),
1211 )
1212
1213 def __get_field_display(self, field):
1214 """Return the display value for a choice field"""

Callers 1

__init__Method · 0.95

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected