recent_history_delete.py 1.2 KB

123456789101112131415161718192021222324252627282930
  1. from .tool.func import *
  2. def recent_history_delete(name = 'Test', rev = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. num = str(rev)
  6. if admin_check(conn) != 1:
  7. return re_error(conn, '/error/3')
  8. if flask.request.method == 'POST':
  9. admin_check(conn, None, 'history delete ' + name + ' r' + num)
  10. curs.execute(db_change("delete from history where id = ? and title = ?"), [num, name])
  11. conn.commit()
  12. return redirect(conn, '/history/' + url_pas(name))
  13. else:
  14. return easy_minify(conn, flask.render_template(skin_check(conn),
  15. imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'history_delete') + ') (r' + num + ')', 0])],
  16. data = '''
  17. <form method="post">
  18. <span>''' + get_lang(conn, 'delete_warning') + '''</span>
  19. <hr class="main_hr">
  20. <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
  21. </form>
  22. ''',
  23. menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
  24. ))