Opened 4 years ago
Closed 4 years ago
#32730 closed New feature (wontfix)
jsonify() method for Q class in django.db.models.query_utils
Reported by: | Austin Hunt | Owned by: | Austin Hunt |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.2 |
Severity: | Normal | Keywords: | query_utils, jsonify, Q |
Cc: | Austin Hunt | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hi,
I have written a new recursive method along with documentation and testing that allows one to translate a Django Q object representing a complex query into JSON format for the purpose of easily re-using and editing complex queries that have been saved via pickling in a database. I am opening this ticket so that I can reference it in a pull request.
https://github.com/django/django/pull/14369
Thank you,
Austin
Change History (5)
comment:1 by , 4 years ago
Cc: | added |
---|---|
Has patch: | set |
comment:2 by , 4 years ago
Description: | modified (diff) |
---|
comment:3 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 4 years ago
Triage Stage: | Accepted → Unreviewed |
---|
It's not appropriate to accept your own ticket. Most probably it would be more appropriate to release this as a third-party package (which of course would have to be a function that takes a Q
object) and see if it gains widespread adoption, but I'll leave the ticket open for another opinion.
comment:5 by , 4 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
I agree with Tim. Q()
is already deconstructible and pickleable so you can use pickle
to save and reuse existing Q()
objects. I think that support for editing Q
objects by users is quite niche and it's not worth the extra complexity. It sounds like a third-party package is the best way to proceed.
Pull request link: https://github.com/django/django/pull/14369