예제 #1
0
 def test_string_formatting(self):
     """ Test the human representation of a message """
     message = Message.objects.get(pk=1)
     truncated_body = truncate_words(message.body, 10)
     self.assertEqual(message.__str__(),
                          truncated_body)
예제 #2
0
파일: models.py 프로젝트: hsingjun0/userena
 def __str__(self):
     """ Human representation, displaying first ten words of the body. """
     truncated_body = truncate_words(self.body, 10)
     return "%(truncated_body)s" % {'truncated_body': truncated_body}
예제 #3
0
 def test_string_formatting(self):
     """Test the human representation of a message"""
     message = Message.objects.get(pk=1)
     truncated_body = truncate_words(message.body, 10)
     self.assertEqual(message.__str__(), truncated_body)
예제 #4
0
 def __unicode__(self):
     """ Human representation, displaying first ten words of the body. """
     truncated_body = truncate_words(self.body, 10)
     return "%(truncated_body)s" % {'truncated_body': truncated_body}