Skip to main content

pickleable Django QuerySet

Project description

OUTLINE

Persistent representation of django QuerySet`s.

Quick creation of simple search functionality without custom SQL or implicit markers/ids/indexes storing.

EXAMPLES

Trivial example

from stored.queryset import FilterQuerySet
q = FilterQuerySet('Q(text__icontains="sometext")', 'someapp.somemodel')
q.objects.all() #outputs all

loads(dumps(q)).objects.all() #same result

Simple with literals

#define default literals
q0 = FilterQuerySet('Q(text__icontains="{literal_text}")',
                    'someapp.somemodel',
                    literal_parameter='"sometext"')

#new queryset with different `literal_text` value
q1 = q0.literal(literal_text='"some_other_text"').objects.all()
#literals are parsed with safe `ast.literal_eval` and can be taken from user input

#q1 can be pickled and thus user search can be stored in db
#if to keep different `FilterQuerySet` for each user.
loads(dumps(q1)).objects.all() #same result

INSTALLATION

Try one of these:

pip install django-stored-queryset
easy_install django-stored-queryset

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_stored_queryset-0.0.2-py2.7.egg (11.5 kB) Copy SHA256 hash SHA256 Egg 2.7
django-stored-queryset-0.0.2.tar.gz (8.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page