Skip to content

Commit e77d046

Browse files
committed
Merge pull request #35 from rpkilby/all-lookups-dict
Add `ALL_LOOKUPS` to filters
2 parents 2b3a1f6 + 0cbb91e commit e77d046

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,21 @@ and also filter on the default lookup (``exact``), as usual::
127127

128128
/api/page/?title=The%20Park
129129

130+
Additionally, you may use ``ALL_LOOKUPS`` with dictionary style declarations.
131+
132+
.. code-block:: python
133+
134+
import rest_framework_filters as filters
135+
136+
class PageFilter(filters.FilterSet):
137+
...
138+
139+
class Meta:
140+
fields = {
141+
'title': filters.ALL_LOOKUPS,
142+
}
143+
144+
130145
Combining RelatedFilter and AllLookupsFilter
131146
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132147

rest_framework_filters/filters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
from django.utils import six
66

77
from django_filters.filters import *
8+
from django_filters.filters import LOOKUP_TYPES
89

910
from . import fields
1011

12+
ALL_LOOKUPS = LOOKUP_TYPES
13+
1114

1215
def _import_class(path):
1316
module_path, class_name = path.rsplit('.', 1)

0 commit comments

Comments
 (0)