def post(self, request, *args, **kwargs): try: instance = OdList.objects.get(id=request.POST['id']) form=OdForm(request.POST,instance=instance) odlist = form.save(commit=False) odlist.save() msg="Record saved" except: msg="Unable to process, Please check all values are present" return HttpResponse(json.dumps(dict(result=msg)), content_type="application/json")
def post(self, request, *args, **kwargs): try: instance = OdList.objects.get(id=request.POST['id']) form = OdForm(request.POST, instance=instance) odlist = form.save(commit=False) odlist.save() msg = "Record saved" except: msg = "Unable to process, Please check all values are present" return HttpResponse(json.dumps(dict(result=msg)), content_type="application/json")
def get(self, request, *args, **kwargs): _od_id = args[0] odObj = OdList.objects.filter(id=_od_id) od = odObj.values()[0] od['id'] = mentObj[0].id od['staff'] = mentObj[0].staff.id form = OdForm(od) print form return render(request, self.template_name, {'form': form})
def post(self, request, *args, **kwargs): form = OdForm(request.POST) odlist = form.save(commit=True) return HttpResponseRedirect('/admin/Od/')
def post(self, request, *args, **kwargs): form=OdForm(request.POST) odlist = form.save(commit=True) return HttpResponseRedirect('/admin/Od/')