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 an upcoming pull
request.
Thank you,
Austin
--
Ticket URL: <https://code.djangoproject.com/ticket/32730>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Austin Hunt (added)
* has_patch: 0 => 1
Comment:
Pull request link: https://github.com/django/django/pull/14369
--
Ticket URL: <https://code.djangoproject.com/ticket/32730#comment:1>
Old description:
> 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 an upcoming pull
> request.
>
> Thank you,
> Austin
New description:
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
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32730#comment:2>
* owner: nobody => Austin Hunt
* status: new => assigned
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/32730#comment:3>
* stage: Accepted => Unreviewed
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/32730#comment:4>
* status: assigned => closed
* resolution: => wontfix
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/32730#comment:5>