Mercurial > kraina_muminkow
view frontend/mfrontend/views/jobcontrol.py @ 20:1e82b288c890
kolejny raz uaktualniam szablon csv, czeka mnie jeszcze poprawianie kodu w pythonie odpowiadajÄ…cego za to
author | Michał Rudowicz <michal.rudowicz@fl9.eu> |
---|---|
date | Mon, 11 Apr 2011 09:39:54 +0200 |
parents | c87f82a15606 |
children | 28eb82047167 |
line wrap: on
line source
#!/usr/bin/python # -*- coding: utf-8 -*- from flask import Module, render_template, request, url_for from flask import escape, session, redirect, flash, abort, g from mfrontend import db, utils, exceptions, decorators jobcontrol = Module(__name__) @jobcontrol.route('/') @decorators.login_required def index(): jobs = db.get_jobs(None, None, None) return render_template('joblist.html', jobs=jobs) @jobcontrol.route('/add/', methods=['GET', 'POST']) @decorators.login_required def add(): if request.method == 'POST': try: db.new_job(session['user_id'], request.form["label"], request.form["hash"], request.form["method"]) return redirect(url_for('index')) except Exception as e: flash(e) return render_template('newjob.html')