Skip to main content

django-query-parser

A django app to parse queries written outside the django app.

Idea

Some queries are controls the business case, so it will be benefical if they are can saved outside the application like in a config file or a database so the logic can be changed without changing the code.

Samples

  1. to write an 'or'
     {"or":{"status_id" : 3, "name__icontains":"Ahmed"}}
    
  2. to write negation
    {"or":{"status_id" : 3, "~name__icontains":"Ahmed"}}
    
  3. to write an 'and'
     {"and":{"status_id" : 3, "name__icontains":"Ahmed"}}
    
    or
    {"status_id" : 3, "name__icontains":"Ahmed"}
    

Installation

pip install django-query-parser

Example

from test_app

from query_parser.Parser import  Parse
d = {"or": {
   "status": "Completed",
   "ordered_by_id": 2
   }}
res = Parse(d)
print(Order.objects.filter(res).count())

Operation Supported

  1. AND
  2. OR
  3. NOT: with a '~' in field name example
    d = {"status": "Completed", "~ordered_by_id": 1}
    

Metadata

Release files for django-query-parser 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-query-parser 0.0.3
File Size Uploaded Provenance Actions
django-query-parser-0.0.3.tar.gz 2.5 kB Without provenance Details for django-query-parser-0.0.3.tar.gz

Release files / django-query-parser-0.0.3.tar.gz

Download URL django-query-parser-0.0.3.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2a7f32aa83999e9e1f6ab796715de69517dc5d0a7acf93eba81dfac15ba1d540
BLAKE2b-256 checksum
How to use checksums
32e3625d1c5ad47386183bbd1ab1f87d78fa970b1038f4d6d764fa293aef79ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.17

Security for django-query-parser 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page