Resolve "CSV Export for linked row field pointing at table with decimal primary key fails"
requested to merge 496-csv-export-for-linked-row-field-pointing-at-table-with-decimal-primary-key-fails into develop
Currently the various file exporters convert a linked row by creating a list of the linked table primary field values and exporting that. The values of this list however could just be the raw JSON field list for a table with a file primary key etc. This MR fixes this issue and a related CSV export bug by converting the primary field values to their export format also resulting in linked rows looking like this when exported:
json
"link_row": [
"linked_row_1",
"linked_row_2",
"unnamed row 3"
],
"decimal_link_row": [
"1.234",
"-123.456",
"unnamed row 3"
],
"file_link_row": [
[
{
"visible_name": "name.txt",
"url": "http://localhost:8000/media/user_files/test_hash.txt"
}
],
"unnamed row 2"
],
xml
<link-row>
<item>linked_row_1</item>
<item>linked_row_2</item>
<item>unnamed row 3</item>
</link-row>
<decimal-link-row>
<item>1.234</item>
<item>-123.456</item>
<item>unnamed row 3</item>
</decimal-link-row>
<file-link-row>
<item>
<item>
<visible_name>name.txt</visible_name>
<url>http://localhost:8000/media/user_files/test_hash.txt</url>
</item>
</item>
<item>
unnamed row 2
</item>
</file-link-row>
csv
"linked_row_1,linked_row_2,unnamed row 3","1.234,-123.456,unnamed row 3","visible_name=name.txt url=http://localhost:8000/media/user_files/test_hash.txt,unnamed row 2"
Testing Notes
- Make a table with a linked row pointing at another table with a decimal/file/etc primary field. Before this MR it would fail, now it should export correctly.
- Table export for a filled table to all formats still works.
- That the slow test all field conversion test still works (no need to check as it's so slow, just marking as i've ran and confirmed this!)
Closes #496 (closed)
Edited by Nigel Gott