Used LogEntry methods to check LogEntry action_flag in __str__

This commit is contained in:
Piotr Jakimiak 2015-05-07 22:52:46 +02:00 committed by Tim Graham
parent 756a727252
commit 34b6b89bd2
1 changed files with 3 additions and 3 deletions

View File

@ -46,14 +46,14 @@ class LogEntry(models.Model):
return smart_text(self.action_time) return smart_text(self.action_time)
def __str__(self): def __str__(self):
if self.action_flag == ADDITION: if self.is_addition():
return ugettext('Added "%(object)s".') % {'object': self.object_repr} return ugettext('Added "%(object)s".') % {'object': self.object_repr}
elif self.action_flag == CHANGE: elif self.is_change():
return ugettext('Changed "%(object)s" - %(changes)s') % { return ugettext('Changed "%(object)s" - %(changes)s') % {
'object': self.object_repr, 'object': self.object_repr,
'changes': self.change_message, 'changes': self.change_message,
} }
elif self.action_flag == DELETION: elif self.is_deletion():
return ugettext('Deleted "%(object)s."') % {'object': self.object_repr} return ugettext('Deleted "%(object)s."') % {'object': self.object_repr}
return ugettext('LogEntry Object') return ugettext('LogEntry Object')