Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trollknurr/django-rest-framework-word-search-filter
Full word search filter backend for Django REST Framework. DB backend independent
https://github.com/trollknurr/django-rest-framework-word-search-filter
filter-backends hacktoberfest
Last synced: 3 months ago
JSON representation
Full word search filter backend for Django REST Framework. DB backend independent
- Host: GitHub
- URL: https://github.com/trollknurr/django-rest-framework-word-search-filter
- Owner: trollknurr
- Created: 2015-05-05T12:22:02.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T06:26:36.000Z (about 4 years ago)
- Last Synced: 2024-07-21T04:03:55.635Z (4 months ago)
- Topics: filter-backends, hacktoberfest
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 72
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-django-rest-framework - django-rest-framework-word-search-filter
README
# Full word filter backend for django REST framework
[![Build Status](https://travis-ci.org/trollknurr/django-rest-framework-word-search-filter.svg?branch=master)](https://travis-ci.org/trollknurr/django-rest-framework-word-search-filter)
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 3.6+, django 3.0+
## 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',)Fill free to send issues or pull requests =)