aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyaggr3g470r/forms.py5
-rw-r--r--pyaggr3g470r/models.py2
-rw-r--r--pyaggr3g470r/templates/edit_feed.html9
-rw-r--r--pyaggr3g470r/views.py3
4 files changed, 12 insertions, 7 deletions
diff --git a/pyaggr3g470r/forms.py b/pyaggr3g470r/forms.py
index e13dde96..deebea3a 100644
--- a/pyaggr3g470r/forms.py
+++ b/pyaggr3g470r/forms.py
@@ -27,7 +27,7 @@ __copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
from flask.ext.wtf import Form
-from wtforms import TextField, TextAreaField, PasswordField, SubmitField, validators
+from wtforms import TextField, TextAreaField, PasswordField, BooleanField, SubmitField, validators
import models
@@ -52,8 +52,9 @@ class SigninForm(Form):
class AddFeedForm(Form):
title = TextField("Title", [validators.Required("Please enter a title.")])
- link = TextField("Feed link", [validators.Required("Please enter a link.")])
+ link = TextField("Feed link", [validators.Required("Please enter a link for the feed.")])
site_link = TextField("Site link", [validators.Required("Please enter a site URL.")])
+ email_notification = BooleanField("Email notification", default=False)
submit = SubmitField("Save")
def __init__(self, *args, **kwargs):
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py
index b99ec09c..1a573ca2 100644
--- a/pyaggr3g470r/models.py
+++ b/pyaggr3g470r/models.py
@@ -60,7 +60,7 @@ class Feed(EmbeddedDocument):
title = StringField(required=True)
link = StringField(required=True, unique=True)
site_link = StringField(required=True)
- mail = BooleanField(default=False)
+ email_notification = BooleanField(default=False)
articles = ListField(ReferenceField('Article', dbref = False))
created_date = DateTimeField(required=True, default=datetime.now)
diff --git a/pyaggr3g470r/templates/edit_feed.html b/pyaggr3g470r/templates/edit_feed.html
index 7bdf2717..28b5d683 100644
--- a/pyaggr3g470r/templates/edit_feed.html
+++ b/pyaggr3g470r/templates/edit_feed.html
@@ -7,13 +7,16 @@
{{ form.hidden_tag() }}
{{ form.title.label }}
- {{ form.title(class_="form-control") }} {% for error in form.title.errors %} <span style="color: red;">{{ error }}</span>{% endfor %}
+ {{ form.title(class_="form-control") }} {% for error in form.title.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
{{ form.link.label }}
- {{ form.link(class_="form-control") }} {% for error in form.link.errors %} <span style="color: red;">{{ error }}</span>{% endfor %}
+ {{ form.link(class_="form-control") }} {% for error in form.link.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
{{ form.site_link.label }}
- {{ form.site_link(class_="form-control") }} {% for error in form.site_link.errors %} <span style="color: red;">{{ error }}</span>{% endfor %}
+ {{ form.site_link(class_="form-control") }} {% for error in form.site_link.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+
+ {{ form.email_notification.label }}
+ {{ form.email_notification(class_="form-control") }}
{{ form.submit(class_="btn") }}
</form>
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 49b0c6a2..79a53ca0 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -223,7 +223,8 @@ def edit_feed(feed_id=None):
return redirect('/feed/'+feed_id)
else:
# Create a new feed
- new_feed = models.Feed(title=form.title.data, link=form.link.data, site_link=form.site_link.data)
+ new_feed = models.Feed(title=form.title.data, link=form.link.data, \
+ site_link=form.site_link.data, email=form.email_notification.data)
user.feeds.append(new_feed)
user.feeds = sorted(user.feeds, key=lambda t: t.title.lower())
user.save()
bgstack15