diff --git a/archivebox/abid_utils/models.py b/archivebox/abid_utils/models.py index 93ce69ab..55aacd13 100644 --- a/archivebox/abid_utils/models.py +++ b/archivebox/abid_utils/models.py @@ -144,17 +144,9 @@ class ABIDModel(models.Model): self.old_id = getattr(self, 'old_id', None) or self.id or uuid4() self.abid = None - self.created = ts_from_abid(abid_part_from_ts(timezone.now())) # cut off precision to match precision of TS component + self.created = ts_from_abid(abid_part_from_ts(getattr(self, 'bookmarked', None) or timezone.now())) # cut off precision to match precision of TS component self.added = getattr(self, 'added', None) or self.created self.modified = self.created - abid_ts_src_attr = self.abid_ts_src.split('self.', 1)[-1] # e.g. 'self.added' -> 'added' - if abid_ts_src_attr and abid_ts_src_attr != 'created' and hasattr(self, abid_ts_src_attr): - # self.added = self.created - existing_abid_ts = getattr(self, abid_ts_src_attr, None) - created_and_abid_ts_are_same = existing_abid_ts and (existing_abid_ts - self.created) < timedelta(seconds=5) - if created_and_abid_ts_are_same: - setattr(self, abid_ts_src_attr, self.created) - assert getattr(self, abid_ts_src_attr) == self.created assert all(self.ABID_FRESH_VALUES.values()), f'Can only issue new ABID if all self.ABID_FRESH_VALUES are defined {self.ABID_FRESH_VALUES}' diff --git a/archivebox/core/admin.py b/archivebox/core/admin.py index d77449d0..18696e56 100644 --- a/archivebox/core/admin.py +++ b/archivebox/core/admin.py @@ -353,10 +353,10 @@ class SnapshotActionForm(ActionForm): class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin): list_display = ('added', 'title_str', 'files', 'size', 'url_str') sort_fields = ('title_str', 'url_str', 'added') - readonly_fields = ('tags_str', 'timestamp', 'admin_actions', 'status_info', 'bookmarked', 'updated', 'created', 'modified', 'API', 'link_dir') + readonly_fields = ('tags_str', 'timestamp', 'admin_actions', 'status_info', 'bookmarked', 'created', 'added', 'updated', 'modified', 'API', 'link_dir') search_fields = ('id', 'url', 'abid', 'old_id', 'timestamp', 'title', 'tags__name') list_filter = ('added', 'updated', 'archiveresult__status', 'created_by', 'tags__name') - fields = ('url', 'created_by', 'title', 'added', *readonly_fields) + fields = ('url', 'created_by', 'title',*readonly_fields) ordering = ['-added'] actions = ['add_tags', 'remove_tags', 'update_titles', 'update_snapshots', 'resnapshot_snapshot', 'overwrite_snapshots', 'delete_snapshots'] inlines = [TagInline, ArchiveResultInline]