예제 #1
0
def person_add():
    form = person_form()
    if form.validate_on_submit():
        controller.add_person(form.data)
        flash('Successfully added a new person')
        return redirect(url_for('view_people'))
    return render_template('person_edit.html', page_title='People Edit', form=form)
예제 #2
0
def person_add():
    form = person_form()
    if form.validate_on_submit():
        controller.add_person(form.data)
        flash('Successfully added a new person')
        return redirect(url_for('view_people'))
    return render_template('person_edit.html',
                           page_title='People Edit',
                           form=form)
예제 #3
0
def person_edit(person_id):
    person = controller.get_person_by_id(person_id)
    form = person_form(first_name = person.first_name, last_name = person.last_name, birthday = person.birthday)
    if form.validate_on_submit():
        for k,v in form.data.items():
            if v is not None:
                controller.update_person(person_id, k, v)
        flash('Successfully updated')
        return redirect(url_for('view_people'))
    return render_template('person_edit.html', page_title='People Edit', person=person, form=form)
예제 #4
0
def person_edit(person_id):
    person = controller.get_person_by_id(person_id)
    form = person_form(first_name=person.first_name,
                       last_name=person.last_name,
                       birthday=person.birthday)
    if form.validate_on_submit():
        for k, v in form.data.items():
            if v is not None:
                controller.update_person(person_id, k, v)
        flash('Successfully updated')
        return redirect(url_for('view_people'))
    return render_template('person_edit.html',
                           page_title='People Edit',
                           person=person,
                           form=form)