aboutsummaryrefslogtreecommitdiff
path: root/newspipe
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-04 14:09:56 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-04 14:09:56 +0100
commit0ff23013dcd9ec74e5a428de72fdbf8234723227 (patch)
treeb5d112755cea993b767d1f5c7d197fe6350e0f77 /newspipe
parentImproved bookmarks template. (diff)
downloadnewspipe-0ff23013dcd9ec74e5a428de72fdbf8234723227.tar.gz
newspipe-0ff23013dcd9ec74e5a428de72fdbf8234723227.tar.bz2
newspipe-0ff23013dcd9ec74e5a428de72fdbf8234723227.zip
Retrun the bookmarks saved during the last 365 days, starting from the date of the most recent one.
Diffstat (limited to 'newspipe')
-rw-r--r--newspipe/web/views/bookmark.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/newspipe/web/views/bookmark.py b/newspipe/web/views/bookmark.py
index c7b4e623..071cf260 100644
--- a/newspipe/web/views/bookmark.py
+++ b/newspipe/web/views/bookmark.py
@@ -93,11 +93,16 @@ def list_(per_page, status="all"):
else:
# query for the shared bookmarks (of all users)
head_titles = [gettext("Recent bookmarks")]
- not_created_before = datetime.datetime.today() - datetime.timedelta(days=900)
- filters["time__gt"] = not_created_before # only "recent" bookmarks
filters["shared"] = True
-
- bookmarks = BookmarkController(user_id).read(**filters).order_by(desc("time"))
+ last_bookmark = (
+ BookmarkController(user_id)
+ .read(**filters)
+ .order_by(desc("time"))
+ .limit(1)[0]
+ )
+ not_created_before = last_bookmark.time - datetime.timedelta(days=365)
+ filters["time__gt"] = not_created_before # only "recent" bookmarks
+ bookmarks = BookmarkController(user_id).read(**filters).order_by(desc("time"))
# tag_contr = BookmarkTagController(user_id)
# tag_contr.read().join(bookmarks).all()
bgstack15