truncate error description in admin

Also removes old conditional imports
This commit is contained in:
Ilan Steemers
2018-08-13 18:50:35 +02:00
parent 83de4c28c7
commit 4076795dc3
3 changed files with 11 additions and 13 deletions
+7 -4
View File
@@ -1,8 +1,7 @@
from django import get_version
try:
from django.urls import reverse
except ImportError: # Django < 1.10
from django.core.urlresolvers import reverse
from django.template.defaultfilters import truncatechars
from django.urls import reverse
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from django.db import models
@@ -82,6 +81,10 @@ class Task(models.Model):
def time_taken(self):
return (self.stopped - self.started).total_seconds()
@property
def short_result(self):
return truncatechars(self.result, 100)
def __unicode__(self):
return u'{}'.format(self.name or self.id)