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

Method to_representation

rest_framework/fields.py:710–717  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

708 self.fail("invalid", input=data)
709
710 def to_representation(self, value):
711 if self._lower_if_str(value) in self.TRUE_VALUES:
712 return True
713 elif self._lower_if_str(value) in self.FALSE_VALUES:
714 return False
715 if self._lower_if_str(value) in self.NULL_VALUES and self.allow_null:
716 return None
717 return bool(value)
718
719
720# String types...

Callers

nothing calls this directly

Calls 1

_lower_if_strMethod · 0.95

Tested by

no test coverage detected