aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-04-12 17:03:20 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-04-12 17:03:20 +0200
commit9a9b5c19d8c07026b104ed81838145454bfa9fc9 (patch)
tree054d348fd66b9c196545037077d6ac3f64b158c5 /pyaggr3g470r/views
parentMerged in jaesivsm/pyaggr3g470r (pull request #8) (diff)
downloadnewspipe-9a9b5c19d8c07026b104ed81838145454bfa9fc9.tar.gz
newspipe-9a9b5c19d8c07026b104ed81838145454bfa9fc9.tar.bz2
newspipe-9a9b5c19d8c07026b104ed81838145454bfa9fc9.zip
It is now possible to add a new feed from any page via a dropdown menu.
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r--pyaggr3g470r/views/feed.py5
-rw-r--r--pyaggr3g470r/views/views.py10
2 files changed, 14 insertions, 1 deletions
diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py
index e4c0dc9a..af43d6f0 100644
--- a/pyaggr3g470r/views/feed.py
+++ b/pyaggr3g470r/views/feed.py
@@ -134,6 +134,8 @@ def form(feed_id=None):
if request.method == 'POST':
if not form.validate():
+ print(dir(form))
+ print("oups")
return render_template('edit_feed.html', form=form)
existing_feeds = list(feed_contr.read(link=form.link.data))
if existing_feeds and feed_id is None:
@@ -141,8 +143,8 @@ def form(feed_id=None):
"warning")
return redirect(url_for('feed.form',
feed_id=existing_feeds[0].id))
-
# Edit an existing feed
+ print("new...")
if feed_id is not None:
feed_contr.update({'id': feed_id},
{'title': form.title.data,
@@ -154,6 +156,7 @@ def form(feed_id=None):
return redirect(url_for('feed.form', feed_id=feed_id))
# Create a new feed
+ print("new feed")
new_feed = FeedController(g.user.id).create(
title=form.title.data,
description="",
diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py
index e06e1a9d..06b234cd 100644
--- a/pyaggr3g470r/views/views.py
+++ b/pyaggr3g470r/views/views.py
@@ -138,6 +138,16 @@ def get_timezone():
except:
return conf.TIME_ZONE["en"]
+@app.context_processor
+def inject_feed_form():
+ """
+ Injects the 'AddFeedForm' objects in all templates.
+
+ Context processors run before the template is rendered and have the
+ ability to inject new values into the template context.
+ """
+ return dict(create_feed_form=AddFeedForm())
+
#
# Views.
#
bgstack15