From 34a1a6d30dd588b6d840c1e9162809e191f652ba Mon Sep 17 00:00:00 2001 From: Cristian Date: Mon, 23 Nov 2020 18:28:43 -0500 Subject: [PATCH] fix: Update model according to code review --- .../core/migrations/0007_archiveresult.py | 12 ++++++------ archivebox/core/models.py | 17 +++++++++++------ archivebox/themes/default/base.html | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/archivebox/core/migrations/0007_archiveresult.py b/archivebox/core/migrations/0007_archiveresult.py index 5da97e29..4b8a074b 100644 --- a/archivebox/core/migrations/0007_archiveresult.py +++ b/archivebox/core/migrations/0007_archiveresult.py @@ -76,14 +76,14 @@ class Migration(migrations.Migration): name='ArchiveResult', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('cmd', models.CharField(default='', max_length=500)), - ('pwd', models.CharField(default='', max_length=200)), - ('cmd_version', models.CharField(default='', max_length=20)), - ('status', models.CharField(max_length=10)), - ('output', models.CharField(default='', max_length=500)), + ('cmd', models.CharField(max_length=500)), + ('pwd', models.CharField(max_length=200)), + ('cmd_version', models.CharField(max_length=32)), + ('status', models.CharField(choices=[('succeeded', 'succeeded'), ('failed', 'failed'), ('skipped', 'skipped')], max_length=16)), + ('output', models.CharField(max_length=500)), ('start_ts', models.DateTimeField()), ('end_ts', models.DateTimeField()), - ('extractor', models.CharField(choices=[('title', 'title'), ('favicon', 'favicon'), ('wget', 'wget'), ('singlefile', 'singlefile'), ('pdf', 'pdf'), ('screenshot', 'screenshot'), ('dom', 'dom'), ('readability', 'readability'), ('mercury', 'mercury'), ('git', 'git'), ('media', 'media'), ('headers', 'headers'), ('archive_org', 'archive_org')], max_length=20)), + ('extractor', models.CharField(choices=[('title', 'title'), ('favicon', 'favicon'), ('wget', 'wget'), ('singlefile', 'singlefile'), ('pdf', 'pdf'), ('screenshot', 'screenshot'), ('dom', 'dom'), ('readability', 'readability'), ('mercury', 'mercury'), ('git', 'git'), ('media', 'media'), ('headers', 'headers'), ('archive_org', 'archive_org')], max_length=32)), ('snapshot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Snapshot')), ], ), diff --git a/archivebox/core/models.py b/archivebox/core/models.py index 41976348..c273c072 100644 --- a/archivebox/core/models.py +++ b/archivebox/core/models.py @@ -11,6 +11,11 @@ from ..index.schema import Link from ..extractors import get_default_archive_methods EXTRACTORS = [(extractor[0], extractor[0]) for extractor in get_default_archive_methods()] +STATUS_CHOICES = [ + ("succeeded", "succeeded"), + ("failed", "failed"), + ("skipped", "skipped") +] class Tag(models.Model): @@ -155,14 +160,14 @@ class Snapshot(models.Model): class ArchiveResult(models.Model): snapshot = models.ForeignKey(Snapshot, on_delete=models.CASCADE) - cmd = models.CharField(max_length=500, default="") - pwd = models.CharField(max_length=200, default="") - cmd_version = models.CharField(max_length=20, default="") - output = models.CharField(max_length=500, default="") + cmd = models.CharField(max_length=500) + pwd = models.CharField(max_length=200) + cmd_version = models.CharField(max_length=32) + output = models.CharField(max_length=500) start_ts = models.DateTimeField() end_ts = models.DateTimeField() - status = models.CharField(max_length=10) - extractor = models.CharField(choices=EXTRACTORS, blank=False, max_length=20) + status = models.CharField(max_length=16, choices=STATUS_CHOICES) + extractor = models.CharField(choices=EXTRACTORS, blank=False, max_length=32) def __str__(self): return self.extractor diff --git a/archivebox/themes/default/base.html b/archivebox/themes/default/base.html index cacd0597..f778da16 100644 --- a/archivebox/themes/default/base.html +++ b/archivebox/themes/default/base.html @@ -225,7 +225,7 @@ } .exists-False { - display: none; + opacity: 0.1; }