Django lookup extensions use NOT query.
- Free software: MIT license
- Documentation: https://django-lookup-extensions.readthedocs.io.
To install Django lookup extensions, run this command in your terminal:
$ pip install django-lookup-extensions
This is the preferred method to install Django lookup extensions, as it will always install the most recent stable release.
If you don't have pip installed, this Python installation guide can guide you through the process.
Add 'lookup_extensions' to your INSTALLED_APPS setting.:
INSTALLED_APPS = [
...
'lookup_extensions',
...
]
AppConfig.ready imports lookups and register them using django.db.models.fields.Field.register_lookup.
Use lookup like Django standard lookups.
ModelA.objects.filter(name__neexact='test name')
neexact is negate exact, neiexact is negate iexact, others are similar.
- neexact
- neiexact
- necontains
- neicontains
- nestartswith
- neendswith
- neistartswith
- neiendswith
- neregex
- neiregex
- complement
These regex lookups support metacharacters \d, \D, w, \W, \s, \S.
MySQL, PostgreSQL and Redshift also support \<, \>.
Prefix follows the previous section.
- exregex
- exiregex
- neexregex
- neexiregex
- MySQL
- PostgreSQL
- sqlite
- lookups using LIKE aren't case sensitive.
- necontains
- nestartswith
- neendswith
- lookups using LIKE aren't case sensitive.
- Redshift
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.