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>
Django 1.1 (or higher). It's possible that works with other versions lower 1.1
INSTALLED_APPS = (
'django_like',
)
Or apply the next Patch (This is not neccesary, you can install the app)
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
- Stack overflow
- Ticket in Django
- Pull request
- Post in a blog
You can get the leading edge version of django-like by doing a checkout of its repository: