mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
Fixed empty tags
This commit is contained in:
parent
bf09c6b40a
commit
4581ea956f
2 changed files with 4 additions and 5 deletions
|
@ -70,7 +70,7 @@ class SnapshotAdmin(admin.ModelAdmin):
|
||||||
return super().get_queryset(request).prefetch_related('tags')
|
return super().get_queryset(request).prefetch_related('tags')
|
||||||
|
|
||||||
def tag_list(self, obj):
|
def tag_list(self, obj):
|
||||||
return u", ".join(o.name for o in obj.tags.all())
|
return ', '.join(obj.tags.values_list('name', flat=True))
|
||||||
|
|
||||||
def id_str(self, obj):
|
def id_str(self, obj):
|
||||||
return format_html(
|
return format_html(
|
||||||
|
|
|
@ -40,7 +40,8 @@ def write_link_to_sql_index(link: Link):
|
||||||
while Snapshot.objects.filter(timestamp=info["timestamp"]).exists():
|
while Snapshot.objects.filter(timestamp=info["timestamp"]).exists():
|
||||||
info["timestamp"] = str(float(info["timestamp"]) + 1.0)
|
info["timestamp"] = str(float(info["timestamp"]) + 1.0)
|
||||||
|
|
||||||
return Snapshot.objects.update_or_create(url=link.url, defaults=info)[0]
|
Snapshot.objects.update_or_create(url=link.url, defaults=info)
|
||||||
|
return Snapshot.objects.get(url=link.url)
|
||||||
|
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
|
@ -72,8 +73,6 @@ def write_sql_link_details(link: Link, out_dir: Path=OUTPUT_DIR) -> None:
|
||||||
tag_list = list(tag_set) or []
|
tag_list = list(tag_set) or []
|
||||||
|
|
||||||
for tag in tag_list:
|
for tag in tag_list:
|
||||||
# TODO check empty tags
|
|
||||||
if snap.tags:
|
|
||||||
snap.tags.add(tag)
|
snap.tags.add(tag)
|
||||||
snap.save()
|
snap.save()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue