Code

Ticket #15661: django-logentry-unicode.2.diff

File django-logentry-unicode.2.diff, 780 bytes (added by Keryn Knight <keryn@…>, 3 years ago)

svn diff against revision 15894

Line 
1Index: django/contrib/admin/models.py
2===================================================================
3--- django/contrib/admin/models.py      (revision 15894)
4+++ django/contrib/admin/models.py      (working copy)
5@@ -33,6 +33,14 @@
6     def __repr__(self):
7         return smart_unicode(self.action_time)
8 
9+    def __unicode__(self):
10+        action_output = {
11+            ADDITION: _('Added "%(object)s".') % {'object': self.object_repr},
12+            CHANGE: _('Changed "%(object)s" - %(changes)s') % {'object': self.object_repr, 'changes': self.change_message},
13+            DELETION: _('Deleted "%(object)s."') % {'object': self.object_repr},
14+        }
15+        return action_output[self.action_flag]
16+
17     def is_addition(self):
18         return self.action_flag == ADDITION
19