From 507e0ce240f739a1d4580405ce2d189390c9f68b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 9 Aug 2019 19:39:46 +0200 Subject: Scrap: add a condition on timeout --- commcrawler/models.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'commcrawler/models.py') diff --git a/commcrawler/models.py b/commcrawler/models.py index 62d12eb..7a80b3b 100644 --- a/commcrawler/models.py +++ b/commcrawler/models.py @@ -141,6 +141,12 @@ class CrawlResult(models.Model): def __str__(self): return "{} - {}".format(self.crawl, self.target) + def short_name(self): + LEN = 50 + if len(self.target.name) < LEN: + return self.target.name + return self.target.name[:LEN] + "..." + def url(self): return self.target.url -- cgit v1.2.3