Django application that provider like and ilike lookup in the querysets
Project description
Django Like
Information
Django Like is a Django application that adds other useful fields.
It is distributed under the terms of the GNU Lesser General Public License <http://www.gnu.org/licenses/lgpl.html>
Requeriments
Django 1.1 (or higher). It’s possible that works with other versions lower 1.1
Installation
In your settings.py
INSTALLED_APPS = ( 'django_like', )
- Or apply some of the next patches (This is not neccesary, you can install the app):
Usage
Anything that you can to do with like sentence in SQL
MyModel.objects.filter(field_name__like='xx%YY%zz') MyModel.objects.filter(field_name__ilike='xx%yy%zz') User.objects.filter(username__like='a%in')
It is more quick that something like this, and more readable:
MyModel.objects.filter(field_name__regex='^xx.*YY.*zz$')
This app provider two new lookups: like and ilike.
Now you can compare the time it takes to run the same query, many times, with like and with regex
python manage.py benchmark_like
These are a results executing the benchmark_like in my machine:
Type & result \ Data base |
postgres |
mysql |
sqllite |
oracle |
---|---|---|---|---|
like |
0:00:50.727005 |
0:00:14.025656 |
0:01:36.089407 |
?:??:??.?????? |
regex |
0:01:38.410019 |
0:02:57.255685 |
0:09:39.527765 |
?:??:??.?????? |
Improvement |
254% |
600% |
503% |
???% |
Reported
Ticket in Django
Development
You can get the bleeding edge version of django-like by doing a clone of its repository:
git clone git://github.com/goinnn/django-like.git
0.0.6 (2013-09-10)
Fix README typo
0.0.5 (2013-08-14)
Fix README typo
0.0.4 (2013-08-14)
Improve the README
Fix a littles bugs
Python3 compatible
Django 1.5 compatible
- Thanks to:
0.0.3 (2012-02-14)
Fix a broken link in the readme
0.0.2 (2012-02-13)
Add benchmark command
0.0.1 (2011-12-28)
First version to django-like
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-like-0.0.6.tar.gz
.
File metadata
- Download URL: django-like-0.0.6.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58ea389542ea84b5d74102100e9356f77e2a293f799331198f24a7e981fd9825 |
|
MD5 | 2bfa93ae9845faee6dfe70e495b033a9 |
|
BLAKE2b-256 | cf3bcba571f95acac9616763dc7683cf2c94fbfe04d3aa24d6a9c35fb945f781 |