diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-08-09 19:39:46 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-08-09 19:39:46 +0200 |
commit | 507e0ce240f739a1d4580405ce2d189390c9f68b (patch) | |
tree | a5a10e8876395dd545433787fc2b036560207c3e /commcrawler/admin.py | |
parent | f7fe0a457eb92611731ba93959f3fca0ceb16528 (diff) | |
download | Comm-on-net-507e0ce240f739a1d4580405ce2d189390c9f68b.tar.bz2 Comm-on-net-507e0ce240f739a1d4580405ce2d189390c9f68b.zip |
Scrap: add a condition on timeout
Diffstat (limited to 'commcrawler/admin.py')
-rw-r--r-- | commcrawler/admin.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/commcrawler/admin.py b/commcrawler/admin.py index 6365e65..e475325 100644 --- a/commcrawler/admin.py +++ b/commcrawler/admin.py @@ -30,8 +30,8 @@ admin_site.register(models.Crawl, CrawlAdmin) class CrawlResultAdmin(admin.ModelAdmin): model = models.CrawlResult list_display = ( - "url", "crawl", "started", "duration", "status", "is_online", - "bad_ssl", "nb_external_link", "nb_internal_link", + "short_name", "open_link", "crawl", "started", "duration", "status", + "is_online", "bad_ssl", "nb_external_link", "nb_internal_link", "nb_images", "nb_facebook", "nb_twitter", "nb_instagram", "nb_youtube", "nb_dailymotion", "nb_vimeo", "nb_video", "nb_audio", "nb_internal_pdf", "nb_external_pdf", "nb_internal_office", "nb_external_office" @@ -49,6 +49,12 @@ class CrawlResultAdmin(admin.ModelAdmin): exclude = ("crawl_result",) form = make_ajax_form(model, {'target': 'target'}) + def open_link(self, obj): + url = obj.url() + if not url: + return "-" + return mark_safe("<a href='{}' target='blank_'>{}</a>".format(url, url)) + def crawl_result_prettified(self, instance): response = json.dumps(instance.crawl_result, sort_keys=True, indent=2) formatter = HtmlFormatter(style='colorful') |