django-import-export / django-import-export

Django application and library for importing and exporting data with admin integration.
https://django-import-export.readthedocs.org/en/latest/
BSD 2-Clause "Simplified" License
3.06k stars 798 forks source link

Python object as JSONWidget input #1796

Closed jeverling closed 5 months ago

jeverling commented 6 months ago

Hi, after ugprading to Django 4.2 we have several errors like TypeError: the JSON object must be str, bytes or bytearray, not dict. It seems that those fields were using a generic widgets.Widget() before, and now get mapped to a widgets.JSONWidget().

I'm wondering, whether it could be a good idea to make the JSONWidget's clean method return the value as-is if it's not deserializable?

matthewhegarty commented 6 months ago

Thanks for raising. Can you confirm which version of django-import-export / python / django? Also I suggest to try with v4 rc as that has a lot of fixes.

Can you give us some steps to reproduce?

jeverling commented 6 months ago

Thanks a lot for your quick reply! We are using Django==4.2.11, django-import-export==3.3.8 and Python 3.8, but I have seen the same behavior with Python 3.12, so the Python version doesn't seem to make a difference.

Thanks for your suggestion to try v4, I will do that.

If that doesn't help I will try to find a way to reproduce the issue in a new Django project.

matthewhegarty commented 6 months ago

Were you able to solve this? Did you try import_export v4?