Answer the question
In order to leave comments, you need to log in
Error while updating django field?
I'm trying to update a field in the database, but I get the error
Cannot force an update in save() with no primary key.
def zaym(request):
if request.method == 'POST':
status = ZaimForm(request.POST)
if status.is_valid():
instance = status.save(commit = False)
instance.save(update_fields = ['status'])
else:
return render_to_response('sms_signup/errors.html')
else:
new_zaim = user_zaim.objects.all()
status = ZaimForm()
return render(request, 'operator/new-zaim.html', {'new_zaim':new_zaim, 'status':status})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question