Esempio n. 1
0
def api_create():
    print("Request :: %s" % request.args )
    if request.args and 'start' in request.args and 'end' in request.args and 'snooze_count' in request.args:
        newGrade = Grade.create(start=int(request.args['start']),
		    end=int(request.args['end']),
            snoozes=int(request.args['snooze_count']))
    else:
        return json.dumps({'success' : False, 'error' : 'Invalid Request'})
    return json.dumps({'success' : True})
Esempio n. 2
0
def home():
    skynet = Skynet()
    messages = []
    data = skynet.get_my_events()
    if data and 'events' in data:
        for event in data['events']:
            if event and 'message' in event:
                print("MESSAGE :: %s " % event['message'])
                messages.append(event['message'])
    form = LoginForm(request.form)
    # Handle logging in
    if request.method == 'POST':
        if form.validate_on_submit():
            login_user(form.user)
            flash("You are logged in.", 'success')
            redirect_url = request.args.get("next") or url_for("user.members")
            return redirect(redirect_url)
        else:
            flash_errors(form)
    grades = Grade.get_recent(100, "created_at DESC");
    return render_template("public/home.html", form=form, grades = grades, messages=messages)
Esempio n. 3
0
def create():
	newGrade = Grade.create(start=int(request.form['start']),
		end=int(request.form['end']),
		snoozes=int(request.form['snooze_count']))
	return render_template("grades/result.html", grade=newGrade)
Esempio n. 4
0
def recent():
	grades = Grade.get_recent(100, "created_at DESC");
	return render_template("grades/recent.html", grades = grades)