Full word search filter backend for Django REST Framework. DB backend independent
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
rest_framework_word_filter
.gitignore
.travis.yml
README.md
manage.py
setup.cfg
setup.py
test_settings.py

README.md

Full word filter backend for django REST framework

Build Status

Database independent (runs without regexp), easy to use full word search backend. Now works with hyphen. Do not use with default ``filters.SearchFilter`

Install

pip install djangorestframework-word-filter

In your settings.py

INSTALLED_APPS += ('rest_framework_word_filter', )

Compatible with python 2.7+, 3.2+, django 1.4+

Using

Import

from rest_framework_word_filter import FullWordSearchFilter
....

and add to filter backends. Add attribute word_fields to define which fields in model will be used for search.

class FooListView(ListAPIView):
    model = Foo
    queryset = Foo.objects.all()
    serializer_class = FooSerializer
    filter_backends = (FullWordSearchFilter, )
    word_fields = ('text',)

This is my first package, if you find mistake - write me, or send pull-request =)