mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
filters_from_request plugin hook, now used in TableView
- New `filters_from_request` plugin hook, closes #473 - Used it to extract the logic from TableView that handles `_search` and `_through` and `_where` - refs #1518 Also needed for this plugin work: https://github.com/simonw/datasette-leaflet-freedraw/issues/7
This commit is contained in:
parent
0663d5525c
commit
aa7f0037a4
7 changed files with 354 additions and 112 deletions
|
|
@ -89,6 +89,17 @@ def actor_from_request(datasette, request):
|
|||
"""Return an actor dictionary based on the incoming request"""
|
||||
|
||||
|
||||
@hookspec
|
||||
def filters_from_request(request, database, table, datasette):
|
||||
"""
|
||||
Return datasette.filters.FilterArguments(
|
||||
where_clauses=[str, str, str],
|
||||
params={},
|
||||
human_descriptions=[str, str, str],
|
||||
extra_context={}
|
||||
) based on the request"""
|
||||
|
||||
|
||||
@hookspec
|
||||
def permission_allowed(datasette, actor, action, resource):
|
||||
"""Check if actor is allowed to perform this action - return True, False or None"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue