def approve_qoute(request, application_id):
approve = get_object_or_404(Application, pk=application_id, created_by=request.user)
if request.method == 'POST':
form = EditStatusForm(request.POST, instance=approve)
if form.is_valid():
approve = form.save(commit=False)
approve.status = request.POST.get('status')
approve.save()
return redirect('dashboard')
else:
form = EditStatusForm(instance=approve)
return render(request, 'job/approve_qoute.html',{'form':form, 'approve':approve})
It would probably help if you posted the complete error message received, along with the form and model being processed here. (I’ll go out on a limb and make a guess that your approve.status field is declared as an integer, where request.POST.get is going to return a string - but that’s only because that’s the only place I can see an error occurring without further information available.)
Also, when you post code here, please post it between lines consisting of only three backtick - ` characters. That means you’ll have a line of ```, followed by your lines of code, followed by another line of ```. This will maintain proper formatting of your code and allow this forum software to display it correctly.