1. Gabriel - Iulian Dumbrava
  2. django-postman

Commits

Gabriel - Iulian Dumbrava  committed ff5fa3b

Added setting POSTMAN_SHOW_USERS_AS to return users's full name if set to "full_name".

  • Participants
  • Parent commits c9770b5
  • Branches default

Comments (0)

Files changed (1)

File postman/models.py

View file
  • Ignore whitespace
 
     @property
     def obfuscated_recipient(self):
-        """Return the recipient either as a username or as an undisclosed email."""
+        """
+        Return the recipient as an username, an undisclosed email or full name.
+        If you set POSTMAN_SHOW_USERS_AS = "full_name" then the full name will be returned.
+        """
+        
         if self.recipient:
-            return unicode(self.recipient)
+            show_users = getattr(settings, 'POSTMAN_SHOW_USERS_AS', None) 
+            if show_users == "full_name":
+                return unicode(self.recipient.get_full_name())
+            else:
+                return unicode(self.recipient)
         else:
             return self._obfuscated_email()