MCPcopy
hub / github.com/django/django / _model_supports_natural_key

Method _model_supports_natural_key

django/core/serializers/base.py:233–238  ·  view source on GitHub ↗

Return True if the model defines a natural_key() method.

(self, model)

Source from the content-addressed store, hash-verified

231 return None
232
233 def _model_supports_natural_key(self, model):
234 """Return True if the model defines a natural_key() method."""
235 try:
236 return callable(model.natural_key)
237 except AttributeError:
238 return False
239
240
241class Deserializer:

Callers 3

handle_m2m_fieldMethod · 0.95
handle_m2m_fieldMethod · 0.95

Calls 1

callableFunction · 0.85

Tested by

no test coverage detected