diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-05-20 07:44:28 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-05-20 07:44:28 +0200 |
commit | 2207a7db83e85abf1d4cfe88a1c340e1332533f3 (patch) | |
tree | 072fc90337315f34716bdd237347a19412c74cd5 /pyaggr3g470r/views.py | |
parent | Improved email notifications. (diff) | |
download | newspipe-2207a7db83e85abf1d4cfe88a1c340e1332533f3.tar.gz newspipe-2207a7db83e85abf1d4cfe88a1c340e1332533f3.tar.bz2 newspipe-2207a7db83e85abf1d4cfe88a1c340e1332533f3.zip |
Send notification messages to platform users.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r-- | pyaggr3g470r/views.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index a9c588a2..4f5c4fb2 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -43,7 +43,7 @@ import export import emails if not conf.ON_HEROKU: import search as fastsearch -from forms import SignupForm, SigninForm, AddFeedForm, ProfileForm +from forms import SignupForm, SigninForm, AddFeedForm, ProfileForm, InformationMessageForm from pyaggr3g470r import app, db, allowed_file, babel from pyaggr3g470r.models import User, Feed, Article, Role from pyaggr3g470r.decorators import feed_access_required @@ -698,8 +698,17 @@ def dashboard(): """ Adminstrator's dashboard. """ + form = InformationMessageForm() + + if request.method == 'POST': + if form.validate(): + try: + emails.information_message(form.subject.data, form.message.data) + except Exception as e: + flash(gettext('Problem while sending email') + ': ' + str(e), 'danger') + users = User.query.all() - return render_template('admin/dashboard.html', users=users, current_user=g.user) + return render_template('admin/dashboard.html', users=users, current_user=g.user, form=form) @app.route('/admin/create_user/', methods=['GET', 'POST']) @app.route('/admin/edit_user/<int:user_id>/', methods=['GET', 'POST']) |