Hi,

Straight from the docs:  

https://docs.djangoproject.com/en/1.8/ref/models/querysets/#pickling-querysets

"If you only want to pickle the necessary information to recreate the QuerySet 
from the database at a later time, pickle the query attribute of the QuerySet."

And in same place there even exists sample code how to restore pickled query.


On Wed, 22 Apr 2015 02:18:11 -0700 (PDT)
guettli <[email protected]> wrote:

> Up to now only Q objects. If you know how to serialize aggregation / 
> annotations, this would be great :-)
> 
> Am Dienstag, 21. April 2015 14:35:52 UTC+2 schrieb Vijay Khemlani:
> >
> > Do you only need to serialize Q objects? No aggregation / annotations?
> >
> > On Tue, Apr 21, 2015 at 8:00 AM, guettli <[email protected] <javascript:>> 
> > wrote:
> >
> >>
> >>
> >> Am Montag, 20. April 2015 17:12:21 UTC+2 schrieb Vijay Khemlani:
> >>>
> >>> Are the queries associated with a certain form? Or they are arbitrary 
> >>> queries?
> >>>
> >>>
> >> Good question. I would prefer a solution which is not associated with a 
> >> form. It is
> >> only associated with a model.
> >>
> >> Otherwise it would be easy. I just need to store the input values of the 
> >> form.
> >>
> >> I know that is very hard to make all filtering features available. But at 
> >> least the basic
> >> filtering should be serializable.
> >>
> >> Regards,
> >>   Thomas Güttler
> >>  
> >>
> >>> On Mon, Apr 20, 2015 at 10:01 AM, guettli <[email protected]> wrote:
> >>>
> >>>> We want to store the QuerySet query (not the result) some how.
> >>>>
> >>>> Background: users should be able to save a complex query as "my 
> >>>> favorite query".
> >>>>
> >>>> Pickling querysets is possible, but version updates are not supported:
> >>>>
> >>>>   
> >>>> https://docs.djangoproject.com/en/1.8/ref/models/querysets/#pickling-querysets
> >>>>
> >>>> Simple queries (without OR) could be saved as dictionary.
> >>>>
> >>>> I have in mind some mini language which enables to store Q object 
> >>>> instances:
> >>>>
> >>>>  Q(foo='bar', blu='bla') | Q(foo='x', blu='y')
> >>>>
> >>>> And ordering ....
> >>>>
> >>>> Before reinventing the wheel, I want to ask if someone has seen or done
> >>>> something like this before.
> >>>>
> >>>> I could not find an existing project. But maybe I used the wrong 
> >>>> keywords for
> >>>> my favorite search engine.
> >>>>
> >>>> Regards,
> >>>>   Thomas Güttler
> >>>>
> >>>> -- 
> >>>> You received this message because you are subscribed to the Google 
> >>>> Groups "Django users" group.
> >>>> To unsubscribe from this group and stop receiving emails from it, send 
> >>>> an email to [email protected].
> >>>> To post to this group, send email to [email protected].
> >>>> Visit this group at http://groups.google.com/group/django-users.
> >>>> To view this discussion on the web visit 
> >>>> https://groups.google.com/d/msgid/django-users/3f75c38e-d2c9-480c-9103-e4ea1bad8f88%40googlegroups.com
> >>>>  
> >>>> <https://groups.google.com/d/msgid/django-users/3f75c38e-d2c9-480c-9103-e4ea1bad8f88%40googlegroups.com?utm_medium=email&utm_source=footer>
> >>>> .
> >>>> For more options, visit https://groups.google.com/d/optout.
> >>>>
> >>>
> >>>  -- 
> >> You received this message because you are subscribed to the Google Groups 
> >> "Django users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to [email protected] <javascript:>.
> >> To post to this group, send email to [email protected] 
> >> <javascript:>.
> >> Visit this group at http://groups.google.com/group/django-users.
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/django-users/a8cc7fc6-4969-4d88-b39f-bd1511cfed54%40googlegroups.com
> >>  
> >> <https://groups.google.com/d/msgid/django-users/a8cc7fc6-4969-4d88-b39f-bd1511cfed54%40googlegroups.com?utm_medium=email&utm_source=footer>
> >> .
> >>
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> >
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a4541c8f-9056-4e09-8a6b-a55fa2367b26%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
Jani Tiainen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150422122700.63e5ffb9%40jns42-l.w2k.keypro.fi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to