MCPcopy Index your code
hub / github.com/encode/django-rest-framework / __getitem__

Method __getitem__

rest_framework/serializers.py:570–578  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

568 yield self[field.field_name]
569
570 def __getitem__(self, key):
571 field = self.fields[key]
572 value = self.data.get(key)
573 error = self.errors.get(key) if hasattr(self, '_errors') else None
574 if isinstance(field, Serializer):
575 return NestedBoundField(field, value, error)
576 if isinstance(field, JSONField):
577 return JSONBoundField(field, value, error)
578 return BoundField(field, value, error)
579
580 # Include a backlink to the serializer class on return objects.
581 # Allows renderers such as HTMLFormRenderer to get the full field info.

Callers

nothing calls this directly

Calls 4

NestedBoundFieldClass · 0.90
JSONBoundFieldClass · 0.90
BoundFieldClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected