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

Filtering a UUID field using the IN operator returns a Django validation error #58

Open
DaanSterk opened this issue Aug 13, 2024 · 0 comments

Comments

@DaanSterk
Copy link

DaanSterk commented Aug 13, 2024

Which version of odata-query are you using?
0.10.0
Django 4.1.9

What went wrong?
Filtering a UUID field using the IN operator returns a Django validation error.

What did you expect to happen?
The OData query should be applied and results matching the IN criterium should be returned.

Detailed steps to reproduce

filter_query = 'id in (952895ec-3264-4132-bc73-71bdbca00be1, 5eec54ba-d290-4c20-a273-61032eb3919e)'
return apply_odata_query(queryset, filter_query)

Traceback (most recent call last):
File "...\Lib\site-packages\django\db\models\fields_init_.py", line 2649, in to_python
return uuid.UUID(**{input_form: value})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\Python312\Lib\uuid.py", line 175, in init
hex = hex.replace('urn:', '').replace('uuid:', '')
^^^^^^^^^^^
AttributeError: 'Value' object has no attribute 'replace'
During handling of the above exception, another exception occurred
...
...\Lib\site-packages\django\db\models\fields_init_.py", line 2651, in to_python
raise exceptions.ValidationError(
django.core.exceptions.ValidationError: ["‘Value(UUID('952895ec-3264-4132-bc73-71bdbca00be1'))’ is geen geldige UUID."]

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

1 participant