def add_db_config(request): if request.method == "POST": form = DbConfigForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('db_config')) else: form = DbConfigForm() return render_to_response('database/add_db_config.html', locals(), RequestContext(request))
def edit_db_config(request, ID): the_db_config = DbConfig.objects.get(id=ID) if request.method == "POST": form = DbConfigForm(request.POST, instance=the_db_config) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('db_config')) else: form = DbConfigForm(instance=the_db_config) return render_to_response('database/edit_db_config.html', locals(), RequestContext(request))