def delete_announcement(id): db.delete_announcement(ObjectId(id)) flash('Announcement %s was deleted if it existed.' % id) return redirect(url_for('.index'))
# -*- coding: utf-8 -*- """ Removes expired announcements from db. Run at least every 2-hours with cron. """ import db import datetime if __name__ == '__main__': for a in db.get_announcements(): if datetime.datetime.now() > a['expiration']: db.delete_announcement(a['_id'])