Fix bug where compound foreign keys produced broken links, closes #1098

This commit is contained in:
Simon Willison 2020-11-29 11:30:17 -08:00
commit deb0be4ae5
6 changed files with 88 additions and 29 deletions

View file

@ -804,12 +804,16 @@ def test_table_html_foreign_key_links(app_client):
'<td class="col-foreign_key_with_label type-str"><a href="/fixtures/simple_primary_key/1">hello</a>\xa0<em>1</em></td>',
'<td class="col-foreign_key_with_blank_label type-str"><a href="/fixtures/simple_primary_key/3">-</a>\xa0<em>3</em></td>',
'<td class="col-foreign_key_with_no_label type-str"><a href="/fixtures/primary_key_multiple_columns/1">1</a></td>',
'<td class="col-foreign_key_compound_pk1 type-str">a</td>',
'<td class="col-foreign_key_compound_pk2 type-str">b</td>',
],
[
'<td class="col-pk type-pk"><a href="/fixtures/foreign_key_references/2">2</a></td>',
'<td class="col-foreign_key_with_label type-none">\xa0</td>',
'<td class="col-foreign_key_with_blank_label type-none">\xa0</td>',
'<td class="col-foreign_key_with_no_label type-none">\xa0</td>',
'<td class="col-foreign_key_compound_pk1 type-none">\xa0</td>',
'<td class="col-foreign_key_compound_pk2 type-none">\xa0</td>',
],
]
@ -836,6 +840,8 @@ def test_table_html_disable_foreign_key_links_with_labels(app_client):
'<td class="col-foreign_key_with_label type-str">1</td>',
'<td class="col-foreign_key_with_blank_label type-str">3</td>',
'<td class="col-foreign_key_with_no_label type-str">1</td>',
'<td class="col-foreign_key_compound_pk1 type-str">a</td>',
'<td class="col-foreign_key_compound_pk2 type-str">b</td>',
]
]