From 708861bcd599adc9e34ea012a0b688e337d8152a Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 17 Oct 2021 14:29:13 +0200 Subject: [PATCH] Enabed edit of custom texts (including categories) in books list --- cps/db.py | 2 +- cps/templates/book_table.html | 2 +- cps/templates/detail.html | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cps/db.py b/cps/db.py index 82696768..456713cd 100644 --- a/cps/db.py +++ b/cps/db.py @@ -407,7 +407,7 @@ class AlchemyEncoder(json.JSONEncoder): # ele = None for ele in data: if hasattr(ele, 'value'): # converter for custom_column values - el = [str(ele.value)] + el.append(str(ele.value)) elif ele.get: el.append(ele.get()) else: diff --git a/cps/templates/book_table.html b/cps/templates/book_table.html index 9d5a448a..f3a4ffb9 100644 --- a/cps/templates/book_table.html +++ b/cps/templates/book_table.html @@ -70,7 +70,7 @@ {{c.name}} {% elif c.datatype in ["bool", "datetime", "comments"] %} - {% elif c.datatype == "text" and not c.is_multiple %} + {% elif c.datatype == "text" %} {{ text_table_row('custom_column_' + c.id|string, _('Enter ') + c.name, c.name, false, false) }} {% else %} diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 6dd1c72a..0ecaf903 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -199,6 +199,8 @@ {{column.value|safe}} {% elif c.datatype == 'series' %} {{ '%s [%s]' % (column.value, column.extra|formatfloat(2)) }} + {% elif c.datatype == 'text' %} + {{ column.value.strip() }}{% if not loop.last %}, {% endif %} {% else %} {{ column.value }} {% endif %}