Returns the serialized data on the serializer.
(self)
| 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) |
no test coverage detected