def handles_add():
    handle = models.handle()
    form = forms.handles(request.form, handle)
    form.id = handle.id
    if request.method == 'POST':
        if form.validate_on_submit():
            g.mysql.add(form.get_instance(handle))
            g.mysql.commit()
            flash('The handle was saved successfully.', 'success')
            return redirect(url_for('administrators.handles_overview'))
        flash('The handle was not saved successfully.', 'danger')
    return render_template('administrators/views/handles_add.html', form=form)
def handles_edit(id):
    handle = g.mysql.query(models.handle).get(id)
    if not handle:
        abort(404)
    form = forms.handles(request.form, handle)
    form.id = handle.id
    if request.method == 'POST':
        if form.validate_on_submit():
            g.mysql.add(form.get_instance(handle))
            g.mysql.commit()
            flash('The handle was updated successfully.', 'success')
            return redirect(url_for('administrators.handles_overview'))
        flash('The handle was not updated successfully.', 'danger')
    return render_template('administrators/views/handles_edit.html', form=form, id=id)