mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-07 18:58:30 +02:00
Add LAST_MODIFIED attribute when exporting (#860)
* add LAST_MODIFIED attribute when exporting * complement test_exporter for LAST_MODIFIED attribute * parse LAST_MODIFIED attribute when importing * use bookmark date_added when no modified date is parsed, otherwise use parsed datetime. * complement test_parser and test_importer for LAST_MODIFIED attribute * cleanup tests a bit --------- Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@gmail.com>
This commit is contained in:
@@ -45,6 +45,7 @@ class BookmarkFactoryMixin:
|
||||
favicon_file: str = "",
|
||||
preview_image_file: str = "",
|
||||
added: datetime = None,
|
||||
modified: datetime = None,
|
||||
):
|
||||
if title is None:
|
||||
title = get_random_string(length=32)
|
||||
@@ -57,13 +58,15 @@ class BookmarkFactoryMixin:
|
||||
url = "https://example.com/" + unique_id
|
||||
if added is None:
|
||||
added = timezone.now()
|
||||
if modified is None:
|
||||
modified = timezone.now()
|
||||
bookmark = Bookmark(
|
||||
url=url,
|
||||
title=title,
|
||||
description=description,
|
||||
notes=notes,
|
||||
date_added=added,
|
||||
date_modified=timezone.now(),
|
||||
date_modified=modified,
|
||||
owner=user,
|
||||
is_archived=is_archived,
|
||||
unread=unread,
|
||||
@@ -320,6 +323,7 @@ class BookmarkHtmlTag:
|
||||
title: str = "",
|
||||
description: str = "",
|
||||
add_date: str = "",
|
||||
last_modified: str = "",
|
||||
tags: str = "",
|
||||
to_read: bool = False,
|
||||
private: bool = True,
|
||||
@@ -328,6 +332,7 @@ class BookmarkHtmlTag:
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.add_date = add_date
|
||||
self.last_modified = last_modified
|
||||
self.tags = tags
|
||||
self.to_read = to_read
|
||||
self.private = private
|
||||
@@ -339,6 +344,7 @@ class ImportTestMixin:
|
||||
<DT>
|
||||
<A {f'HREF="{tag.href}"' if tag.href else ''}
|
||||
{f'ADD_DATE="{tag.add_date}"' if tag.add_date else ''}
|
||||
{f'LAST_MODIFIED="{tag.last_modified}"' if tag.last_modified else ''}
|
||||
{f'TAGS="{tag.tags}"' if tag.tags else ''}
|
||||
TOREAD="{1 if tag.to_read else 0}"
|
||||
PRIVATE="{1 if tag.private else 0}">
|
||||
|
Reference in New Issue
Block a user