django-rest-framework
django-rest-framework copied to clipboard
JSONField with write_only
The model serializer is defined as below
class OrderSerializer(serializers.ModelSerializer):
product_info = serializers.JSONField(write_only=True, help_text='[{"id":1, "count":1},...]')
But the serializer can't get the product_info data use serializer.data in views and it shows:
TypeError: 'NoneType' object is not iterable
serializer.data should not be used for deserialization (write_only).
On a side note, couldn't reproduce either.
@xordoquy serializer.validated_data works fine