def post(self, request, *args, **kwargs): try: instance = Mentorship.objects.get(id=request.POST['mid']) form=MentorshipForm(request.POST,instance=instance) mentor = form.save(commit=False) mentor.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 = Mentorship.objects.get(id=request.POST['mid']) form = MentorshipForm(request.POST, instance=instance) mentor = form.save(commit=False) mentor.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): form = MentorshipForm(request.POST) mentorship = form.save(commit=True) return HttpResponseRedirect('/admin/mentors')
def post(self, request, *args, **kwargs): form=MentorshipForm(request.POST) mentorship = form.save(commit=True) return HttpResponseRedirect('/admin/mentors')