Skip to content

Commit 65b5fd7

Browse files
author
Maciej Lewinski
committed
Added docs and changelog
ref T35707
1 parent eeae26e commit 65b5fd7

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
## HEAD
22

3+
### Chained qualifiers
4+
Chained qualifiers have been added [T35707](https://phabricator.codeyellow.nl/T35707). For more information on how they work and how to use it see [documentation](/docs/api.md)
5+
6+
#### Breaking change
7+
8+
The `_filter_field` method signature has been changed from
9+
```
10+
def _filter_field(self, field_name, qualifier, value, invert, request, include_annotations, partial=''):
11+
```
12+
to
13+
```
14+
def _filter_field(self, field_name, qualifiers, value, invert, request, include_annotations, partial=''):
15+
```
16+
17+
So it now contains an array of qualifiers instead of THE qualifier.
18+
So for the call `api/caretaker?.last_seen:date:range` it will contain both date and range qualifiers.
19+
20+
To get previously used qualifier variable and upgrade previously written code that was overriding `_filter_field` use:
21+
```
22+
qualifier = qualifiers[0]
23+
```
24+
See full changes [here](https://github.com/CodeYellowBV/django-binder/pull/206/files#diff-0d5633deb444395cd44b49e7a39f87da98bb86de20666038277730991c62b1a5).
25+
26+
327
### Breaking changes
428

529
The `_filter_field` method now returns a `Q()` object, not a queryset.

docs/api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ To use a partial case-insensitive match, you can use `api/animal?.name:icontains
4949

5050
Note that currently, it is not possible to search on many-to-many fields.
5151

52+
#### Chaining multiple qualifiers
53+
Sometimes there is a need to chain multiple qualifiers in filtering. For example if you want to convert datetime to date and then do a range filtering.
54+
This can be achieved by using `api/caretaker?.last_seen:date:range`
55+
56+
Other example would be if you want to search for city names, but without using accent in the names. For example search for `Weißenhorn` using term `weiss` or search for `Lünen` using `Lunen`. The syntax for it would be `.city_name:unaccent:icontains`. Take into account that for unaccent to work you need to install postgres `unaccent` extension.
57+
58+
5259
#### More advanced searching
5360

5461
Sometimes you want to search on multiple fields at once.

0 commit comments

Comments
 (0)