django-rest-framework-bulk
django-rest-framework-bulk copied to clipboard
UUIDs are not handled
BulkSerializerMixin uses get_value()
to get the id of an object, but doesn't use to_internal_value()
to convert the id to the proper internal value. This works fine for integer ids, but it breaks for UUIDs because the all_validated_data_by_id
in BulkListSerializer.update
constructs a dict by string id and then tries to get values for instance ids (which are UUIDs and thus not in the dictionary.)
Workaround / solution is to copy BulkSerializerMixin into your app and replace this line:
id_value = id_field.get_value(data)
with this one:
id_value = id_field.to_internal_value(id_field.get_value(data))
Thank you, solved my problem!
Thank you, solved my problem!
This also solved my problem bulk_update & bulk_partial_update fail, but others work fine:
python3.8/site-packages/rest_framework/serializers.py", line 986, in update for attr, value in validated_data.items(): AttributeError: 'NoneType' object has no attribute 'items' [17/Mar/2021 22:17:04] "PUT /api/ruleset/ HTTP/1.1" 500 29444