aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views
diff options
context:
space:
mode:
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