Exemple #1
0
def courses_create():
    form = CourseForm(request.form)

    if not form.validate():
        return render_template("courses/new.html", form=form)

    c = Course(form.name.data, form.description.data)
    c.account_id = current_user.id

    db.session().add(c)
    db.session().commit()

    return redirect(url_for("courses_index"))
Exemple #2
0
def courses_create():
    form = CourseForm(request.form)

    if not form.validate():
        return render_template("courses/new.html", form=form)

    t = Course(form.name.data, form.location.data, form.startingDate.data,
               form.endingDate.data, form.description.data, form.price.data,
               form.organizerIban.data)

    if current_user.iban == "":
        current_user.iban = form.organizerIban.data

    t.account_id = current_user.id

    db.session().add(t)
    db.session().commit()

    return redirect(url_for("courses_index"))