Example #1
0
def add_manager(request):
    form = ManagerForm()
    if request.method == 'POST':
        if request.form and form.validate(request.form):
            manager = form.save()
            manager.put()
            return redirect(url_for('admin/managers'))
    return render_to_response('admin/add_manager.html', {'form':form.as_widget()})
Example #2
0
def edit_manager(request, key):
    manager = Manager.get(key)
    form = ManagerForm(manager)
    if request.method == 'POST':
        if request.form and form.validate(request.form):
            manager = form.save()
            manager.put()
            return redirect(url_for('admin/managers'))
    photo_form = ManagerPhoto()
    return render_to_response('admin/edit_manager.html', {'manager':manager, 'form':form.as_widget(), 'photo_form':photo_form.as_widget()})