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.

Source Distribution

django-stored-queryset-0.0.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_stored_queryset-0.0.2-py2.7.egg (11.5 kB view details)

Uploaded Egg

File details

Details for the file django-stored-queryset-0.0.2.tar.gz.

File metadata

File hashes

Hashes for django-stored-queryset-0.0.2.tar.gz
Algorithm Hash digest
SHA256 da735d53fa1a6c036cd2427e11a522146cda73dcaf5a35f527c25f67ba9099cf
MD5 8edcaa52990239682fa773d9f39ca429
BLAKE2b-256 bf4d91b59d57b9bef9ead148f8ab8da457b902752ac926ddde5e430f3c27678f

See more details on using hashes here.

File details

Details for the file django_stored_queryset-0.0.2-py2.7.egg.

File metadata

File hashes

Hashes for django_stored_queryset-0.0.2-py2.7.egg
Algorithm Hash digest
SHA256 f978cc1dc7a5de2105a0aef0968737d55138332666f31e1b1ab6a3ffaaa7e515
MD5 49ea96fe19c2f890755d0e51d14dcfe1
BLAKE2b-256 d63ff27351beec7c383a9bdfa5726d156d1aca22a4fb2ac61c8425f582b18adf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page