Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUIDs are not handled #66

Open
melinath opened this issue Sep 13, 2017 · 4 comments
Open

UUIDs are not handled #66

melinath opened this issue Sep 13, 2017 · 4 comments

Comments

@melinath
Copy link

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.)

@melinath
Copy link
Author

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))

@hudsonbrendon
Copy link

Thank you, solved my problem!

1 similar comment
@rodrigo-xavier
Copy link

Thank you, solved my problem!

@zbragg-s5
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants