Пример #1
0
def update(id):
    timesheet = Timesheet.get_by_id(id)
    form = EditTimesheetForm(request.form, obj=timesheet)

    if form.validate_on_submit():
        form.populate_obj(obj=timesheet)
        db.session.commit()
        flash("timesheet updated")
        return redirect(url_for("timesheet.index"))
    return render_template("timesheets/timesheet_edit.html", form=form, timesheet=timesheet)
Пример #2
0
def edit(id):
    timesheet = Timesheet.get_by_id(id)
    form = EditTimesheetForm(request.form, obj=timesheet)
    form.populate_form(timesheet)
    return render_template("timesheets/timesheet_edit.html", form=form, timesheet=timesheet)