I thing you don't want to use the save() method. You can always write down for e.g., like this.
class PointSerializer: def save(self): self.instance = Point(self.validated_data) return self.instance s = PointSerializer(...) s.is_valid(raise_exception=True) instance = s.save()
or
You want do instead look like:my_serializer.is_valid(raise_exception=True) instance = my_serializer.save()And also you have a guide with this link's, can you follow it.1) http://www.django-rest-framework.org/api-guide/fields/#custom-fields2) https://github.com/encode/django-rest-framework/blob/90ed2c1ef7c652ce0a98075c422d25a632d62507/rest_framework/serializers.py#L468-L471
|
|
Sender notified by Mailtrack 05/24/19, 10:59:19 AM |
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/e6cd5749-4092-4d8a-b1a3-ec42ce56b520%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.