github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/498#issuecomment-505635729 | https://api.github.com/repos/simonw/datasette/issues/498 | 505635729 | MDEyOklzc3VlQ29tbWVudDUwNTYzNTcyOQ== | 9599 | 2019-06-25T21:48:46Z | 2019-06-25T21:48:46Z | OWNER | Hmmm... you know I think I actually need this for my https://github.com/simonw/fara-datasette project... https://fara.datasettes.com/fara?sql=select+1+as+sortme%2C+%27FARA_All_RegistrantDocs%27+as+%27table%27%2C+rowid+as+id%2C+Document_Type+%7C%7C+%27+%27+%7C%7C+Short_Form_Name+%7C%7C+%27+for+%27+%7C%7C+Registrant_Name+as+title%0D%0Afrom+FARA_All_RegistrantDocs%0D%0A++where+rowid+in+%28select+rowid+from+FARA_All_RegistrantDocs_fts+where+FARA_All_RegistrantDocs_fts+match+%3Asearch%0D%0A++++order+by+rank+limit+10%0D%0A%29%0D%0Aunion%0D%0Aselect+2+as+sortme%2C+%27FARA_All_ForeignPrincipals%27+as+%27table%27%2C+rowid+as+id%2C+Foreign_Principal+%7C%7C+%27+for+%27+%7C%7C+%22Country%2FLocation_Represented%22+as+title%0D%0Afrom+FARA_All_ForeignPrincipals%0D%0A++where+rowid+in+%28select+rowid+from+FARA_All_ForeignPrincipals_fts+where+FARA_All_ForeignPrincipals_fts+match+%3Asearch%0D%0A++++order+by+rank+limit+10%0D%0A%29%0D%0Aunion%0D%0Aselect+3+as+sortme%2C+%27FARA_All_Registrants%27+as+%27table%27%2C+rowid+as+id%2C+Name+%7C%7C+%27+on+%27+%7C%7C+Registration_Date+%7C%7C+%27+in+%27+%7C%7C+City+as+title%0D%0Afrom+FARA_All_Registrants%0D%0A++where+rowid+in+%28select+rowid+from+FARA_All_Registrants_fts+where+FARA_All_Registrants_fts+match+%3Asearch%0D%0A++++order+by+rank+limit+10%0D%0A%29%0D%0Aunion%0D%0Aselect+4+as+sortme%2C+%27FARA_All_ShortForms%27+as+%27table%27%2C+rowid+as+id%2C+Short_Form_First_Name+%7C%7C+%27+%27+%7C%7C+Short_Form_Last_Name+%7C%7C+%27+in+%27+%7C%7C+City+as+title%0D%0Afrom+FARA_All_ShortForms%0D%0A++where+rowid+in+%28select+rowid+from+FARA_All_ShortForms_fts+where+FARA_All_ShortForms_fts+match+%3Asearch%0D%0A++++order+by+rank+limit+10%0D%0A%29%0D%0A%0D%0A&search=cohen | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
451513541 | |
https://github.com/simonw/datasette/issues/521#issuecomment-505422550 | https://api.github.com/repos/simonw/datasette/issues/521 | 505422550 | MDEyOklzc3VlQ29tbWVudDUwNTQyMjU1MA== | 9599 | 2019-06-25T12:28:48Z | 2019-06-25T12:28:48Z | OWNER | Still needed before merge: documentation! I can expand this section: https://datasette.readthedocs.io/en/stable/custom_templates.html#custom-templates | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
459621683 | |
https://github.com/simonw/datasette/issues/521#issuecomment-505421892 | https://api.github.com/repos/simonw/datasette/issues/521 | 505421892 | MDEyOklzc3VlQ29tbWVudDUwNTQyMTg5Mg== | 9599 | 2019-06-25T12:26:54Z | 2019-06-25T12:26:54Z | OWNER | This is starting to shape up. Example template: ``` {% for row in display_rows %} <div> <hr> <h2 class="scientist"> {{ row["First_Name"] }} {{ row["Last_Name"] }} </h2> {% if row["Link_to_Photo"] %} <img style="max-width: 300px" src="{{ row["Link_to_Photo"] }}"> {% endif %} {% for cell in row.cells[3:] %} {% if cell.raw and cell.column != "createdTime" %} <p><strong>{{ cell.column }}: </strong>{{ cell.value }}</p> {% endif %} {% endfor %} </div> {% endfor %} ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
459621683 | |
https://github.com/simonw/datasette/issues/521#issuecomment-505405030 | https://api.github.com/repos/simonw/datasette/issues/521 | 505405030 | MDEyOklzc3VlQ29tbWVudDUwNTQwNTAzMA== | 9599 | 2019-06-25T11:34:21Z | 2019-06-25T11:34:21Z | OWNER | Actually I'm OK here - `display_columns_and_rows()` is already only used by the HTML template rendering path. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
459621683 | |
https://github.com/simonw/datasette/issues/521#issuecomment-505280611 | https://api.github.com/repos/simonw/datasette/issues/521 | 505280611 | MDEyOklzc3VlQ29tbWVudDUwNTI4MDYxMQ== | 9599 | 2019-06-25T04:46:10Z | 2019-06-25T04:46:10Z | OWNER | Of course I can't do it in this part of he code because it's constructing plain JSON objects here. I'll need to do it in the section that prepares special objects for the HTML. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
459621683 | |
https://github.com/simonw/datasette/issues/521#issuecomment-505279560 | https://api.github.com/repos/simonw/datasette/issues/521 | 505279560 | MDEyOklzc3VlQ29tbWVudDUwNTI3OTU2MA== | 9599 | 2019-06-25T04:40:16Z | 2019-06-25T04:40:38Z | OWNER | I think the trick is to redefine what a "cell_row" is. Each row is currently a list of cells: https://github.com/simonw/datasette/blob/6341f8cbc7833022012804dea120b838ec1f6558/datasette/views/table.py#L159-L163 I can redefine the row (the `cells` variable in the above example) as a thing-that-iterates-cells (hence behaving like a list) but that also supports `__getitem__` access for looking up cell values if you know the name of the column. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
459621683 |