Skip to content

Commit 66e7153

Browse files
Maciej Lewinskimacias
authored andcommitted
Added docs and changelog
ref T35707
1 parent 8522091 commit 66e7153

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,6 +1,30 @@
11

22
## HEAD
33

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

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