From f04b45fc4ee30e87415a474e9f3c402661a1d4fc Mon Sep 17 00:00:00 2001 From: Julian Rother <julianr@fsmpi.rwth-aachen.de> Date: Sat, 10 Sep 2016 12:33:19 +0200 Subject: [PATCH] Replace new_announcement with create --- db_schema.sql | 4 ++-- server.py | 9 --------- templates/index.html | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/db_schema.sql b/db_schema.sql index 452a4ed..5496ae1 100644 --- a/db_schema.sql +++ b/db_schema.sql @@ -185,8 +185,8 @@ CREATE TABLE IF NOT EXISTS `videos_data` ( ); CREATE TABLE IF NOT EXISTS `announcements` ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - `text` text NOT NULL, - `internal` text NOT NULL, + `text` text NOT NULL DEFAULT "Neue Ankündigung", + `internal` text NOT NULL DEFAULT "", `level` INTEGER NOT NULL DEFAULT 0, `visible` INTEGER NOT NULL DEFAULT 0, `deleted` INTEGER NOT NULL DEFAULT 0, diff --git a/server.py b/server.py index 1acfce8..769228a 100755 --- a/server.py +++ b/server.py @@ -398,15 +398,6 @@ def suggest_chapter(lectureid): return redirect(request.values['ref']) return 'OK', 200 -@app.route('/newpsa', methods=['POST', 'GET']) -@mod_required -def new_announcement(): - id = modify('INSERT INTO announcements (text, internal, time_created, time_updated, created_by) VALUES ("Neue Ankündigung", "", ?, ?, ?)', - datetime.now(), datetime.now(), session.get('user', {'dbid':None})['dbid']) - if 'ref' in request.values: - return redirect(request.values['ref']) - return id, 200 - @app.route('/newfeatured', methods=['POST', 'GET']) @mod_required def new_featured(): diff --git a/templates/index.html b/templates/index.html index 15609d8..51f74e1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,7 +8,7 @@ <ul class="list-inline pull-right"> {% if ismod() %} <li style="padding-right: 0px;"> - <a class="btn btn-default" href="{{ url_for('new_announcement', ref=request.url) }}">Neue Ankündigung</a> + <a class="btn btn-default" href="{{ url_for('create', table='announcements', ref=request.url) }}">Neue Ankündigung</a> </li> {% endif %} </ul> -- GitLab