aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/bookmark.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-29 00:33:51 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-29 00:33:51 +0200
commit1e7f1434b062a81b46cd434bd30c309b7252c057 (patch)
treeb0ce7dff08ada2c56a56d4b7cdf3923dc0655ef2 /src/web/views/bookmark.py
parentupdated layout (diff)
downloadnewspipe-1e7f1434b062a81b46cd434bd30c309b7252c057.tar.gz
newspipe-1e7f1434b062a81b46cd434bd30c309b7252c057.tar.bz2
newspipe-1e7f1434b062a81b46cd434bd30c309b7252c057.zip
added some fitlters for the bookmarks page
Diffstat (limited to 'src/web/views/bookmark.py')
-rw-r--r--src/web/views/bookmark.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py
index 9263b49f..841d7364 100644
--- a/src/web/views/bookmark.py
+++ b/src/web/views/bookmark.py
@@ -49,15 +49,29 @@ bookmark_bp = Blueprint('bookmark', __name__, url_prefix='/bookmark')
@bookmarks_bp.route('/', defaults={'per_page': '50'}, methods=['GET'])
-def list_(per_page):
+@bookmarks_bp.route('/<string:status>', defaults={'per_page': '50'},
+ methods=['GET'])
+def list_(per_page, status='all'):
"Lists the bookmarks."
head_titles = [gettext("Bookmarks")]
if current_user.is_authenticated:
# query for the bookmarks of the authenticated user
- bookmark_query = BookmarkController(current_user.id).read()
+ filters = {}
+ if status == 'public':
+ filters['shared'] = True
+ elif status == 'private':
+ filters['shared'] = False
+ else:
+ # no filter
+ pass
+ if status == 'unread':
+ filters['to_read'] = True
+ else:
+ pass
+ bookmark_query = BookmarkController(current_user.id).read(**filters)
else:
- # shared bookmarks of all users
+ # query for the shared bookmarks (of all users)
bookmark_query = BookmarkController().read(**{'shared': True})
bookmarks = bookmark_query.order_by(desc('time'))
bgstack15