mirror of
https://github.com/simonw/datasette.git
synced 2026-09-16 13:34:07 +02:00
Fix for render_cell() pks for SQL views, refs #2639
This commit is contained in:
parent
7c8ed1015e
commit
27b7240f30
3 changed files with 4 additions and 3 deletions
|
|
@ -671,7 +671,7 @@ async def display_columns_and_rows(
|
|||
}
|
||||
pks = await db.primary_keys(table_name)
|
||||
pks_for_display = pks
|
||||
if not pks_for_display:
|
||||
if not pks_for_display and not await db.view_exists(table_name):
|
||||
pks_for_display = ["rowid"]
|
||||
label_column = None
|
||||
if link_column:
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ Datasette plugins can now use **background tasks** to run code independent of th
|
|||
Bug fixes
|
||||
~~~~~~~~~
|
||||
|
||||
- The :ref:`render_cell() <plugin_hook_render_cell>` plugin hook now receives an empty ``pks`` list when rendering SQL views in HTML, matching the JSON ``?_extra=render_cell`` behavior. (:issue:`2639`)
|
||||
- Numeric comparison filters now correctly handle decimal values, negative numbers and scientific notation when filtering computed columns and SQL views. Thanks, `Rami Abdelrazzaq <https://github.com/RamiNoodle733>`__. (:issue:`1681`, :pr:`2876`)
|
||||
- Fixed CSV streaming with ``?_stream=on`` on SQL views repeating the second page of results until the CSV size limit was reached. Thanks, `Ankita Advitot <https://github.com/AnkitaAdvitot>`__. (:issue:`2902`, :pr:`2903`)
|
||||
|
||||
|
|
|
|||
|
|
@ -495,10 +495,10 @@ Lets you customize the display of values within table cells in the HTML table vi
|
|||
The name of the column being rendered
|
||||
|
||||
``table`` - string or None
|
||||
The name of the table - or ``None`` if this is a custom SQL query
|
||||
The name of the table or view - or ``None`` if this is a custom SQL query
|
||||
|
||||
``pks`` - list of strings
|
||||
The primary key column names for the table being rendered. For tables without an explicitly defined primary key, this will be ``["rowid"]``. For custom SQL queries and views (where ``table`` is ``None``), this will be an empty list ``[]``.
|
||||
The primary key column names for the table being rendered. For tables without an explicitly defined primary key, this will be ``["rowid"]``. For custom SQL queries and views, this will be an empty list ``[]``.
|
||||
|
||||
``database`` - string
|
||||
The name of the database
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue