kopia lustrzana https://github.com/simonw/datasette
Added 'not like' table filter, refs #750
rodzic
4df1b4d8b0
commit
b3aa5f4313
|
@ -137,6 +137,9 @@ class Filters:
|
|||
"lte", "\u2264", '"{c}" <= :{p}', "{c} \u2264 {v}", numeric=True
|
||||
),
|
||||
TemplatedFilter("like", "like", '"{c}" like :{p}', '{c} like "{v}"'),
|
||||
TemplatedFilter(
|
||||
"notlike", "not like", '"{c}" not like :{p}', '{c} not like "{v}"'
|
||||
),
|
||||
TemplatedFilter("glob", "glob", '"{c}" glob :{p}', '{c} glob "{v}"'),
|
||||
InFilter(),
|
||||
NotInFilter(),
|
||||
|
|
|
@ -216,6 +216,9 @@ You can filter the data returned by the table based on column values using a que
|
|||
``?column__like=value``
|
||||
Match rows with a LIKE clause, case insensitive and with ``%`` as the wildcard character.
|
||||
|
||||
``?column__notlike=value``
|
||||
Match rows that do not match the provided LIKE clause.
|
||||
|
||||
``?column__glob=value``
|
||||
Similar to LIKE but uses Unix wildcard syntax and is case sensitive.
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ import pytest
|
|||
['"foo" like :p0', '"foo" like :p1'],
|
||||
["2%2", "3%3"],
|
||||
),
|
||||
# notlike:
|
||||
((("foo__notlike", "2%2"),), ['"foo" not like :p0'], ["2%2"],),
|
||||
(
|
||||
(("foo__isnull", "1"), ("baz__isnull", "1"), ("bar__gt", "10")),
|
||||
['"bar" > :p0', '"baz" is null', '"foo" is null'],
|
||||
|
|
Ładowanie…
Reference in New Issue