Пример #1
0
def delete_announcement(id):
    db.delete_announcement(ObjectId(id))
    flash('Announcement %s was deleted if it existed.' % id)
    return redirect(url_for('.index'))
Пример #2
0
# -*- 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'])