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

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.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-stored-queryset-0.0.1.tar.gz
Algorithm Hash digest
SHA256 bc45715e8ea4b4ad938a30c5a3f6dd8111eb5e405da1fc193b235ae7fabb209f
MD5 c59cc5546179af12c44ec3d5a1f98f8a
BLAKE2b-256 62cc0ede3030ec873bafa488987583b88eab08f22dfed5caff70b9bc0b6fd490

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for django_stored_queryset-0.0.1-py2.7.egg
Algorithm Hash digest
SHA256 73209871fc2533677a3f5830f819198caee9634c2c698d3272ead2c5e33a33be
MD5 65d942f9868d7864788f114835e39f50
BLAKE2b-256 5f6e91cd1fdc67b19f68326b7e3b479894f03dc6cfff5cb9e41900e8d0ba9911

See more details on using hashes here.

Provenance

Supported by

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