MCPcopy
hub / github.com/alanjds/drf-nested-routers / data

Method data

rest_framework/serializers.py:554–575  ·  view source on GitHub ↗

Returns the serialized data on the serializer.

(self)

Source from the content-addressed store, hash-verified

552
553 @property
554 def data(self):
555 """
556 Returns the serialized data on the serializer.
557 """
558 if self._data is None:
559 obj = self.object
560
561 if self.many is not None:
562 many = self.many
563 else:
564 many = hasattr(obj, '__iter__') and not isinstance(obj, (Page, dict))
565 if many:
566 warnings.warn('Implicit list/queryset serialization is deprecated. '
567 'Use the `many=True` flag when instantiating the serializer.',
568 DeprecationWarning, stacklevel=2)
569
570 if many:
571 self._data = [self.to_native(item) for item in obj]
572 else:
573 self._data = self.to_native(obj)
574
575 return self._data
576
577 def save_object(self, obj, **kwargs):
578 obj.save(**kwargs)

Callers 6

bootstrap.min.jsFile · 0.80
JFunction · 0.80
JFunction · 0.80

Calls 1

to_nativeMethod · 0.95

Tested by

no test coverage detected