diff --git a/advlabdb/advlabdb_independent_funs.py b/advlabdb/advlabdb_independent_funs.py index 668c61b..83d0ddb 100644 --- a/advlabdb/advlabdb_independent_funs.py +++ b/advlabdb/advlabdb_independent_funs.py @@ -37,18 +37,28 @@ def missing_formatter(view, context, model, name): def str_without_semester_formatter(view, context, model, name): attr = deep_getattr(model, name) - if attr is not None: - return attr.str_without_semester() - return attr + if attr is None: + return "" + + if hasattr(attr, "__iter__") and not isinstance(attr, str): + # List of attributes + return ", ".join([a.str_without_semester() for a in attr]) + + return attr.str_without_semester() def str_formatter(view, context, model, name): attr = deep_getattr(model, name) - if attr is not None: - return attr.str() - return attr + if attr is None: + return "" + + if hasattr(attr, "__iter__") and not isinstance(attr, str): + # List of attributes + return ", ".join([a.str() for a in attr]) + + return attr.str() def _details_link(url, attr, attr_formatter):