diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-05-10 15:56:20 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:50 +0200 |
commit | 5f574fffb6474f98ca75671e22fc2e840b69a69c (patch) | |
tree | 57448f647d5d9fbbccf3057387fb0c21370e54ee /ishtar_common | |
parent | 1682e081b9f1e3ce34e88613f58f5b670e75b85d (diff) | |
download | Ishtar-5f574fffb6474f98ca75671e22fc2e840b69a69c.tar.bz2 Ishtar-5f574fffb6474f98ca75671e22fc2e840b69a69c.zip |
Admin - Export - CSV: field sort function -> lambda (refs #5251)
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/admin.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py index f5729d9de..3ae767393 100644 --- a/ishtar_common/admin.py +++ b/ishtar_common/admin.py @@ -170,14 +170,9 @@ def export_as_csv_action( if hasattr(modeladmin, "CSV_FIELD_ORDER"): field_order = modeladmin.CSV_FIELD_ORDER - def sort_csv(value): - if value not in field_order: - return 1000 - else: - return field_order.index(value) - field_names = sorted( - field_names, key=sort_csv + field_names, + key=lambda x: field_order.index(x) if x in field_order else 1000 ) response = HttpResponse(content_type="text/csv") |