mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
add snapshot_id to Link and uuid to ArchiveResult
This commit is contained in:
parent
0b8bdd8cc5
commit
05e891632c
2 changed files with 14 additions and 4 deletions
|
@ -178,6 +178,7 @@ class Link:
|
|||
raise
|
||||
|
||||
def _asdict(self, extended=False):
|
||||
from core.models import Snapshot
|
||||
info = {
|
||||
'schema': 'Link',
|
||||
'url': self.url,
|
||||
|
@ -190,6 +191,7 @@ class Link:
|
|||
}
|
||||
if extended:
|
||||
info.update({
|
||||
'snapshot_id': self.snapshot_id,
|
||||
'link_dir': self.link_dir,
|
||||
'archive_path': self.archive_path,
|
||||
|
||||
|
@ -258,6 +260,11 @@ class Link:
|
|||
|
||||
return to_csv(self, cols=cols or self.field_names(), separator=separator, ljust=ljust)
|
||||
|
||||
@cached_property
|
||||
def snapshot_id(self):
|
||||
from core.models import Snapshot
|
||||
return str(Snapshot.objects.only('id').get(url=self.url).id)
|
||||
|
||||
@classmethod
|
||||
def field_names(cls):
|
||||
return [f.name for f in fields(cls)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue