Added column__not=blah filter

Closes #148
pull/168/head
Simon Willison 2017-11-23 14:09:50 -08:00
rodzic 4b7596ee5c
commit b450778391
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: FBB38AFE227189DB
2 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -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='{}%'),

Wyświetl plik

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