From 7b3631eed5481551540cd9a728d4efc97f232f08 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 1 Sep 2021 17:23:00 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Display=20user-friendly=20name?= =?UTF-8?q?=20for=20`ResearchProject`s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/sophon/projects/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/sophon/projects/models.py b/backend/sophon/projects/models.py index d1af4be..831efd0 100644 --- a/backend/sophon/projects/models.py +++ b/backend/sophon/projects/models.py @@ -45,6 +45,13 @@ class ResearchProject(SophonGroupModel): max_length=16, ) + def get_visibility_emoji(self): + return { + "PUBLIC": "🌍", + "INTERNAL": "🏭", + "PRIVATE": "🔒", + }[self.visibility] + def get_group(self) -> ResearchGroup: return self.group @@ -81,3 +88,6 @@ class ResearchProject(SophonGroupModel): "description", "visibility", } + + def __str__(self): + return f"{self.get_visibility_emoji()} {self.name}"