def AddIdc(request): form = IdcListForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('listidcurl')) else: form = IdcListForm() kwvars = { 'form': form, 'request': request, } return render_to_response('IdcManage/idc.add.html', kwvars, RequestContext(request))
def EditIdc(request, ID): idc = IdcList.objects.get(id=ID) if request.method == 'POST': form = IdcListForm(request.POST, instance=idc) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('listidcurl')) else: form = IdcListForm(instance=idc) kwvars = { 'ID': ID, 'form': form, 'request': request, } return render_to_response('IdcManage/idc.edit.html', kwvars, RequestContext(request))