-
Notifications
You must be signed in to change notification settings - Fork 771
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
Catch JSONField error to prevent not being able to show the response data #1666
Comments
Hi @loeeess — thanks for the report. So I think a Would you fancy taking that on? |
Thanks for your reply, @carltongibson! Sounds like a good solution to me. And yes, I can look into it. |
I just added a PR (#1675) for this issue. I realize the documentation for the |
@loeeess Great work thanks. I left an initial comment. Let's carry on there. 👍 |
Hello,
I use
django-filter
in combination with DRF and I have created a custom base view for GET requests that is used for various models, and returns a list of all object instances of the selected model. Some of these models have aJSONField
, others don't. I usedjango-filter
for each field of the models. BecauseJSONField
is not covered by django-filter by default, it causes a 500 error when I retrieve the list of model instances for a model that includes aJSONField
in the response, see the following response:I am aware of the fact that I can indeed write a custom filter (which I did, works fine). But without this custom implementation, the error prevents me from viewing the GET response in the first place.
My proposed solutions would be to either;
JSONField
when creating the filters for the model attributes. Then a user can still retrieve their requested data, the only downside being that theJSONField
attributes are not included in the filter list.JSONField
in the package, where it is possible to define which key/value pairs can be filtered on.Thank you.
The text was updated successfully, but these errors were encountered: