kopia lustrzana https://github.com/simonw/datasette
				
				
				
			New ?column__date=yyyy-mm-dd filter
							rodzic
							
								
									1c6649b19b
								
							
						
					
					
						commit
						583b22aa28
					
				|  | @ -100,6 +100,7 @@ class Filters: | ||||||
|             where j.value = :{p} |             where j.value = :{p} | ||||||
|         )""", '{c} contains "{v}"') |         )""", '{c} contains "{v}"') | ||||||
|     ] if detect_json1() else []) + [ |     ] if detect_json1() else []) + [ | ||||||
|  |         TemplatedFilter('date', 'date', 'date({c}) = :{p}', '"{c}" is on date {v}'), | ||||||
|         TemplatedFilter('isnull', 'is null', '"{c}" is null', '{c} is null', no_argument=True), |         TemplatedFilter('isnull', 'is null', '"{c}" is null', '{c} is null', no_argument=True), | ||||||
|         TemplatedFilter('notnull', 'is not null', '"{c}" is not null', '{c} is not null', no_argument=True), |         TemplatedFilter('notnull', 'is not null', '"{c}" is not null', '{c} is not null', no_argument=True), | ||||||
|         TemplatedFilter('isblank', 'is blank', '("{c}" is null or "{c}" = "")', '{c} is blank', no_argument=True), |         TemplatedFilter('isblank', 'is blank', '("{c}" is null or "{c}" = "")', '{c} is blank', no_argument=True), | ||||||
|  |  | ||||||
|  | @ -233,6 +233,9 @@ You can filter the data returned by the table based on column values using a que | ||||||
| 
 | 
 | ||||||
|     This is only available if the ``json1`` SQLite extension is enabled. |     This is only available if the ``json1`` SQLite extension is enabled. | ||||||
| 
 | 
 | ||||||
|  | ``?column__date=value`` | ||||||
|  |     Column is a datestamp occurring on the specified YYYY-MM-DD date, e.g. ``2018-01-02``. | ||||||
|  | 
 | ||||||
| ``?column__isnull=1`` | ``?column__isnull=1`` | ||||||
|     Matches rows where the column is null. |     Matches rows where the column is null. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -60,6 +60,14 @@ import pytest | ||||||
|         ['foo in (:p0, :p1, :p2)'], |         ['foo in (:p0, :p1, :p2)'], | ||||||
|         ["1", "2", "3"] |         ["1", "2", "3"] | ||||||
|     ), |     ), | ||||||
|  |     # date | ||||||
|  |     ( | ||||||
|  |         { | ||||||
|  |             "foo__date": "1988-01-01", | ||||||
|  |         }, | ||||||
|  |         ["date(foo) = :p0"], | ||||||
|  |         ["1988-01-01"] | ||||||
|  |     ), | ||||||
|     # JSON array variants of __in (useful for unexpected characters) |     # JSON array variants of __in (useful for unexpected characters) | ||||||
|     ( |     ( | ||||||
|         { |         { | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Simon Willison
						Simon Willison