]> git.parisson.com Git - django-postman.git/commitdiff
first and last name in place of the username
authoryomguy <yomguy@parisson.com>
Thu, 14 Feb 2013 17:51:03 +0000 (18:51 +0100)
committeryomguy <yomguy@parisson.com>
Thu, 14 Feb 2013 17:51:03 +0000 (18:51 +0100)
postman/models.py
postman/templatetags/postman_tags.py

index 5174af588f0d13162fac29f5e87b69f9cd5313e8..fa592b46321e0cc1b83b9a31ebbd15b29776c9f4 100644 (file)
@@ -45,7 +45,7 @@ def get_order_by(query_dict):
     ``query_dict``: a dictionary to look for a key dedicated to ordering purpose
 
     >>> get_order_by({})
-    
+
     >>> get_order_by({ORDER_BY_KEY: 'f'})
     'sender__username'
     >>> get_order_by({ORDER_BY_KEY: 'D'})
@@ -119,7 +119,7 @@ class MessageManager(models.Manager):
 
         """
         return self.inbox(user, related=False, option=OPTION_MESSAGES).filter(read_at__isnull=True).count()
-    
+
     def sent(self, user, **kwargs):
         """
         Return all messages sent by a user but not marked as archived or deleted.
index 4b3bad7369ff62680d8ff315d88c6413a3587fbd..da421f8574b851748b7830bc264055ffbd57d409 100644 (file)
@@ -33,10 +33,9 @@ def or_me(value, arg):
     Typical usage: sender|or_me:user
 
     """
-    if not isinstance(value, (unicode, str)):
-        value = unicode(value)
-    if not isinstance(arg, (unicode, str)):
-        arg = unicode(arg)
+    value = unicode(value.first_name) + ' ' + unicode(value.last_name)
+    arg = unicode(arg.first_name) + ' ' + unicode(arg.last_name)
+
     return _('<me>') if value == arg else value
 
 @register.filter(**({'expects_localtime': True, 'is_safe': False} if VERSION >= (1, 4) else {}))