From 29db8bc0c742c83148eb781ff334664c8c90c5a8 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Thu, 1 Aug 2024 13:20:51 +0200
Subject: [PATCH] add title helper with dr default in contributor

---
 scipost_django/scipost/models.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scipost_django/scipost/models.py b/scipost_django/scipost/models.py
index 1525fa28f..7841caab8 100644
--- a/scipost_django/scipost/models.py
+++ b/scipost_django/scipost/models.py
@@ -28,6 +28,7 @@ from .constants import (
     AUTHORSHIP_CLAIM_STATUS,
     CONTRIBUTOR_STATUSES,
     NEWLY_REGISTERED,
+    TITLE_DR,
 )
 from .fields import ChoiceArrayField
 from .managers import (
@@ -232,6 +233,10 @@ class Contributor(models.Model):
             or self.user.is_superuser
         )
 
+    @property
+    def profile_title(self) -> str:
+        return self.profile.get_title_display() if self.profile else TITLE_DR
+
     def generate_key(self, feed=""):
         """Generate a new activation_key for the contributor, given a certain feed."""
         for i in range(5):
-- 
GitLab