A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/trollknurr/django-rest-framework-word-search-filter below:

trollknurr/django-rest-framework-word-search-filter: Full word search filter backend for Django REST Framework. DB backend independent

Full word filter backend for django REST framework

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

pip install djangorestframework-word-filter

In your settings.py

INSTALLED_APPS += ('rest_framework_word_filter', )

Compatible with python 3.6+, django 3.0+

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 =)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4