From 8b0d40ea4b44b35d61395739a709eaf65234be98 Mon Sep 17 00:00:00 2001 From: Gytha Ogg Date: Tue, 8 Oct 2024 10:40:22 +0200 Subject: [PATCH] feat(sample_project): example for MoreLessColumn --- sample_project/tables.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sample_project/tables.py diff --git a/sample_project/tables.py b/sample_project/tables.py new file mode 100644 index 000000000..0fa659251 --- /dev/null +++ b/sample_project/tables.py @@ -0,0 +1,14 @@ +from apis_core.apis_entities.tables import AbstractEntityTable +from apis_core.generic.tables import MoreLessColumn + + +class PersonTable(AbstractEntityTable): + class Meta(AbstractEntityTable.Meta): + sequence = ["desc", "bio"] + + # example column to show preview and detail + bio = MoreLessColumn( + orderable=False, + preview=lambda x: f"This is {x.surname}", + fulltext=lambda x: f"This is {x.surname}, {x.forename} {x.surname}.", + )