kopia lustrzana https://github.com/simonw/datasette
rodzic
4b7596ee5c
commit
b450778391
|
@ -332,6 +332,7 @@ class Filter:
|
|||
class Filters:
|
||||
_filters = [
|
||||
Filter('exact', '=', '"{c}" = :{p}', lambda c, v: '{c} = {v}' if v.isdigit() else '{c} = "{v}"'),
|
||||
Filter('not', '!=', '"{c}" != :{p}', lambda c, v: '{c} != {v}' if v.isdigit() else '{c} != "{v}"'),
|
||||
Filter('contains', 'contains', '"{c}" like :{p}', '{c} contains "{v}"', format='%{}%'),
|
||||
Filter('endswith', 'ends with', '"{c}" like :{p}', '{c} ends with "{v}"', format='%{}'),
|
||||
Filter('startswith', 'starts with', '"{c}" like :{p}', '{c} starts with "{v}"', format='{}%'),
|
||||
|
|
|
@ -254,6 +254,10 @@ def test_paginate_tables_and_views(app_client, path, expected_rows, expected_pag
|
|||
('/test_tables/simple_primary_key.json?content__exact=', [
|
||||
['3', ''],
|
||||
]),
|
||||
('/test_tables/simple_primary_key.json?content__not=world', [
|
||||
['1', 'hello'],
|
||||
['3', ''],
|
||||
]),
|
||||
])
|
||||
def test_table_filter_queries(app_client, path, expected_rows):
|
||||
response = app_client.get(path, gather_request=False)
|
||||
|
|
Ładowanie…
Reference in New Issue