From 8958e328e805010ba8b261ea21e9a035ddec30bf Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sun, 25 Jun 2023 18:04:00 +0300 Subject: [PATCH] Add the show format for the Group. --- tui_rsync/models/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tui_rsync/models/models.py b/tui_rsync/models/models.py index 99f8f92..269f8ff 100644 --- a/tui_rsync/models/models.py +++ b/tui_rsync/models/models.py @@ -188,6 +188,16 @@ class Group(BaseModel): def __repl__(self) -> str: return f"{self.label}" + def show_format(self) -> str: + output = f"[b]label:[/] {self.label}\n" \ + f"[b]sources:[/] \n" + + for source in self.sources: + prefix = '\t' + output+=f"{source.source.show_format(prefix)}\n" + + return output + class GroupSource(BaseModel): group = ForeignKeyField(Group, backref='sources') source = ForeignKeyField(Source)