aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-10-10 12:59:32 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-26 23:46:30 +0100
commit1095a049a63e4286da620b914c23411ea7a02e64 (patch)
tree6afebddd12fe4fd67f2a789ab16803c356974d7f /src/web
parentbase modification in model for category support (diff)
downloadnewspipe-1095a049a63e4286da620b914c23411ea7a02e64.tar.gz
newspipe-1095a049a63e4286da620b914c23411ea7a02e64.tar.bz2
newspipe-1095a049a63e4286da620b914c23411ea7a02e64.zip
base category creation/edition
Diffstat (limited to 'src/web')
-rw-r--r--src/web/controllers/__init__.py5
-rw-r--r--src/web/forms.py20
-rw-r--r--src/web/views/__init__.py1
3 files changed, 15 insertions, 11 deletions
diff --git a/src/web/controllers/__init__.py b/src/web/controllers/__init__.py
index ad77fa1d..a1b89ea8 100644
--- a/src/web/controllers/__init__.py
+++ b/src/web/controllers/__init__.py
@@ -1,8 +1,9 @@
from .feed import FeedController
+from .category import CategoryController
from .article import ArticleController
from .user import UserController
from .icon import IconController
-__all__ = ['FeedController', 'ArticleController', 'UserController',
- 'IconController']
+__all__ = ['FeedController', 'CategoryController', 'ArticleController',
+ 'UserController', 'IconController']
diff --git a/src/web/forms.py b/src/web/forms.py
index 447a54e9..d901f260 100644
--- a/src/web/forms.py
+++ b/src/web/forms.py
@@ -27,7 +27,7 @@ __copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
-from flask import flash, request, url_for, redirect
+from flask import flash, url_for, redirect
from flask.ext.wtf import Form
from flask.ext.babel import lazy_gettext
from wtforms import TextField, TextAreaField, PasswordField, BooleanField, \
@@ -57,7 +57,9 @@ class SignupForm(Form):
def validate(self):
validated = super(SignupForm, self).validate()
if self.nickname.data != User.make_valid_nickname(self.nickname.data):
- self.nickname.errors.append(lazy_gettext('This nickname has invalid characters. Please use letters, numbers, dots and underscores only.'))
+ self.nickname.errors.append(lazy_gettext(
+ 'This nickname has invalid characters. '
+ 'Please use letters, numbers, dots and underscores only.'))
validated = False
return validated
@@ -102,7 +104,6 @@ class SigninForm(RedirectForm):
return False
else:
flash(lazy_gettext('Invalid email or password'), 'danger')
- #self.email.errors.append("Invalid email or password")
return False
@@ -124,7 +125,9 @@ class UserForm(Form):
def validate(self):
validated = super(UserForm, self).validate()
if self.nickname.data != User.make_valid_nickname(self.nickname.data):
- self.nickname.errors.append(lazy_gettext('This nickname has invalid characters. Please use letters, numbers, dots and underscores only.'))
+ self.nickname.errors.append(lazy_gettext(
+ 'This nickname has invalid characters. '
+ 'Please use letters, numbers, dots and underscores only.'))
validated = False
return validated
@@ -168,10 +171,10 @@ class AddFeedForm(Form):
enabled = BooleanField(lazy_gettext("Check for updates"), default=True)
submit = SubmitField(lazy_gettext("Save"))
- def validate(self):
- if not super(AddFeedForm, self).validate():
- return False
- return True
+
+class AddCategoryForm(Form):
+ name = TextField(lazy_gettext("Name"))
+ submit = SubmitField(lazy_gettext("Sign up"))
class InformationMessageForm(Form):
@@ -201,5 +204,4 @@ class RecoverPasswordForm(Form):
return False
else:
flash(lazy_gettext('Invalid email.'), 'danger')
- #self.email.errors.append("Invalid email")
return False
diff --git a/src/web/views/__init__.py b/src/web/views/__init__.py
index 36d382bd..1da9205b 100644
--- a/src/web/views/__init__.py
+++ b/src/web/views/__init__.py
@@ -3,4 +3,5 @@ from .api import *
from .article import article_bp, articles_bp
from .feed import feed_bp, feeds_bp
+from .category import category_bp, categories_bp
from .icon import icon_bp
bgstack15