switch everywhere to use Snapshot.pk and ArchiveResult.pk instead of id

This commit is contained in:
Nick Sweeting 2024-05-13 05:12:12 -07:00
parent 9733b8d04c
commit 0420662174
No known key found for this signature in database
15 changed files with 175 additions and 104 deletions

View file

@ -192,6 +192,9 @@ class Link:
if extended:
info.update({
'snapshot_id': self.snapshot_id,
'snapshot_uuid': self.snapshot_uuid,
'snapshot_abid': self.snapshot_abid,
'link_dir': self.link_dir,
'archive_path': self.archive_path,
@ -261,9 +264,21 @@ class Link:
return to_csv(self, cols=cols or self.field_names(), separator=separator, ljust=ljust)
@cached_property
def snapshot_id(self):
def snapshot(self):
from core.models import Snapshot
return str(Snapshot.objects.only('id').get(url=self.url).id)
return Snapshot.objects.only('uuid').get(url=self.url)
@cached_property
def snapshot_id(self):
return str(self.snapshot.pk)
@cached_property
def snapshot_uuid(self):
return str(self.snapshot.uuid)
@cached_property
def snapshot_abid(self):
return str(self.snapshot.ABID)
@classmethod
def field_names(cls):