mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed incorrect display of compound primary keys with foreign key references
Closes #319
This commit is contained in:
parent
3683a6b626
commit
3b53eea382
5 changed files with 122 additions and 10 deletions
|
|
@ -550,6 +550,26 @@ def test_row_html_compound_primary_key(app_client):
|
|||
assert expected == [[str(td) for td in tr.select('td')] for tr in table.select('tbody tr')]
|
||||
|
||||
|
||||
def test_compound_primary_key_with_foreign_key_references(app_client):
|
||||
# e.g. a many-to-many table with a compound primary key on the two columns
|
||||
response = app_client.get('/fixtures/searchable_tags')
|
||||
assert response.status == 200
|
||||
table = Soup(response.body, 'html.parser').find('table')
|
||||
expected = [
|
||||
[
|
||||
'<td class="col-Link"><a href="/fixtures/searchable_tags/1,feline">1,feline</a></td>',
|
||||
'<td class="col-searchable_id"><a href="/fixtures/searchable/1">1</a>\xa0<em>1</em></td>',
|
||||
'<td class="col-tag"><a href="/fixtures/tags/feline">feline</a></td>',
|
||||
],
|
||||
[
|
||||
'<td class="col-Link"><a href="/fixtures/searchable_tags/2,canine">2,canine</a></td>',
|
||||
'<td class="col-searchable_id"><a href="/fixtures/searchable/2">2</a>\xa0<em>2</em></td>',
|
||||
'<td class="col-tag"><a href="/fixtures/tags/canine">canine</a></td>',
|
||||
],
|
||||
]
|
||||
assert expected == [[str(td) for td in tr.select('td')] for tr in table.select('tbody tr')]
|
||||
|
||||
|
||||
def test_view_html(app_client):
|
||||
response = app_client.get('/fixtures/simple_view')
|
||||
assert response.status == 200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue