Mercurial > kraina_muminkow
view frontend/mfrontend/views/jobcontrol.py @ 13:79cf8ca2a0e5
Dodałem pobieranie informacji o podanym zadaniu oraz pobieranie zadania oczekującego poprzez API
author | Michał Rudowicz <michal.rudowicz@fl9.eu> |
---|---|
date | Fri, 01 Apr 2011 19:02:08 +0200 |
parents | 58a993029d9f |
children | c87f82a15606 |
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"]) return redirect(url_for('index')) except Exception as e: flash(e) return render_template('newjob.html')