Skip to content
Snippets Groups Projects
Commit 45651018 authored by Julian Rother's avatar Julian Rother
Browse files

Added backend support for featured articles

parent e0f75739
No related branches found
No related tags found
No related merge requests found
......@@ -194,6 +194,17 @@ CREATE TABLE IF NOT EXISTS `announcements` (
`time_updated` datetime NOT NULL,
`created_by` INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS `featured` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`title` text NOT NULL DEFAULT "Neuer Artikel",
`text` text NOT NULL DEFAULT "",
`internal` text NOT NULL DEFAULT "",
`visible` INTEGER NOT NULL DEFAULT 0,
`deleted` INTEGER NOT NULL DEFAULT 0,
`time_created` datetime NOT NULL,
`time_updated` datetime NOT NULL,
`created_by` INTEGER NOT NULL
);
CREATE VIEW IF NOT EXISTS `courses` AS select * from `courses_data` where (not(`courses_data`.`deleted`));
CREATE VIEW IF NOT EXISTS `lectures` AS select * from `lectures_data` where (not(`lectures_data`.`deleted`));
......
......@@ -144,7 +144,8 @@ def index():
GROUP BY videos.lecture_id
ORDER BY lastvidtime DESC
LIMIT 6 ''',ismod())
return render_template('index.html', latestvideos=latestvideos, upcomming=upcomming)
featured = query('SELECT * FROM featured WHERE NOT deleted AND (? OR visible)', ismod())
return render_template('index.html', latestvideos=latestvideos, upcomming=upcomming, featured=featured)
@app.route('/course')
@register_navbar('Videos', icon='film')
......@@ -384,6 +385,15 @@ def new_announcement():
return redirect(request.values['ref'])
return id, 200
@app.route('/newfeatured', methods=['POST', 'GET'])
@mod_required
def new_featured():
id = query('INSERT INTO featured (time_created, time_updated, created_by) VALUES (?, ?, ?)',
datetime.now(), datetime.now(), session.get('user', {'dbid':None})['dbid'])
if 'ref' in request.values:
return redirect(request.values['ref'])
return id, 200
import feeds
import importer
import schedule
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment