diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-04 07:51:58 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-04 07:51:58 +0100 |
commit | d60d30c083175bb3680148000085a4e4d91a1ae0 (patch) | |
tree | 58a385c1a2f2c1f852db444de839f94440f925b9 /pyaggr3g470r/views | |
parent | Merged in jaesivsm/pyaggr3g470r/evol/api (pull request #6) (diff) | |
download | newspipe-d60d30c083175bb3680148000085a4e4d91a1ae0.tar.gz newspipe-d60d30c083175bb3680148000085a4e4d91a1ae0.tar.bz2 newspipe-d60d30c083175bb3680148000085a4e4d91a1ae0.zip |
The feed abject should be loaded when 'feed_id' is not None.
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r-- | pyaggr3g470r/views/views.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py index 5279d7fe..f1178f34 100644 --- a/pyaggr3g470r/views/views.py +++ b/pyaggr3g470r/views/views.py @@ -554,7 +554,6 @@ def edit_feed(feed_id=None): """ Add or edit a feed. """ - feed = FeedController(g.user.id).get(id=feed_id) form = AddFeedForm() if request.method == 'POST': @@ -562,13 +561,14 @@ def edit_feed(feed_id=None): return render_template('edit_feed.html', form=form) if feed_id is not None: # Edit an existing feed + feed = FeedController(g.user.id).get(id=feed_id) form.populate_obj(feed) db.session.commit() flash(gettext('Feed successfully updated.'), 'success') return redirect('/edit_feed/' + str(feed_id)) else: # Create a new feed - existing_feed = [f for f in g.user.feeds if feed.link == form.link.data] + existing_feed = [f for f in g.user.feeds if f.link == form.link.data] if len(existing_feed) == 0: new_feed = Feed(title=form.title.data, description="", link=form.link.data, \ site_link=form.site_link.data, enabled=form.enabled.data) @@ -587,6 +587,7 @@ def edit_feed(feed_id=None): if request.method == 'GET': if feed_id is not None: + feed = FeedController(g.user.id).get(id=feed_id) form = AddFeedForm(obj=feed) return render_template('edit_feed.html', action=gettext("Edit the feed"), form=form, feed=feed, \ not_on_heroku = not conf.ON_HEROKU) |