From 106d83ea8157c6f14a399716381ddf07ac21a024 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 24 Oct 2016 13:30:11 +0200 Subject: add the possibility to mak a feed as private --- src/web/views/feed.py | 3 ++- src/web/views/user.py | 8 +++++--- src/web/views/views.py | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/web/views') diff --git a/src/web/views/feed.py b/src/web/views/feed.py index 6338f320..92aef10a 100644 --- a/src/web/views/feed.py +++ b/src/web/views/feed.py @@ -191,7 +191,8 @@ def process_form(feed_id=None): # Edit an existing feed feed_attr = {'title': form.title.data, 'enabled': form.enabled.data, 'link': form.link.data, 'site_link': form.site_link.data, - 'filters': [], 'category_id': form.category_id.data} + 'filters': [], 'category_id': form.category_id.data, + 'private': form.private.data} if not feed_attr['category_id'] or feed_attr['category_id'] == '0': del feed_attr['category_id'] diff --git a/src/web/views/user.py b/src/web/views/user.py index fc94f205..682e20ff 100644 --- a/src/web/views/user.py +++ b/src/web/views/user.py @@ -29,6 +29,10 @@ def profile_public(nickname=None): if not user.is_public_profile: return redirect(url_for('home')) + filters = {} + filters['private__eq'] = False + feeds = FeedController(user.id).read(**filters).all() + """word_size = 6 filters = {} filters['retrieved_date__gt'] = datetime.now() - timedelta(weeks=10) @@ -36,9 +40,7 @@ def profile_public(nickname=None): top_words = misc_utils.top_words(articles, n=50, size=int(word_size)) tag_cloud = misc_utils.tag_cloud(top_words)""" - return render_template('profile_public.html', - user=user, - feeds=user.feeds) + return render_template('profile_public.html', user=user, feeds=feeds) @user_bp.route('/management', methods=['GET', 'POST']) diff --git a/src/web/views/views.py b/src/web/views/views.py index 8703edba..8024b27d 100644 --- a/src/web/views/views.py +++ b/src/web/views/views.py @@ -64,6 +64,7 @@ def popular(): filters = {} filters['created_date__gt'] = not_added_before + filters['private__eq'] = False feeds = FeedController().count_by_link(**filters) sorted_feeds = sorted(list(feeds.items()), key=operator.itemgetter(1), reverse=True) -- cgit