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

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 Austin Hunt, 4 years ago

Cc: Austin Hunt added
Has patch: set

comment:2 by Austin Hunt, 4 years ago

Description: modified (diff)

comment:3 by Austin Hunt, 4 years ago

Owner: changed from nobody to Austin Hunt
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:4 by Tim Graham, 4 years ago

Triage Stage: AcceptedUnreviewed

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 Mariusz Felisiak, 4 years ago

Resolution: wontfix
Status: assignedclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top