5我正在尝试通过公式器修改数据库中的元组,但此后一直无法这样做。我想要一个有效的示例代码。 Views.py
def modifier_ue(request, code):
if request.method == 'POST':
ue_form = UEForms(request.POST);
if ue_form.is_valid() and 'supprimer' in request.POST:
return HttpResponse('supprimer');
elif ue_form.is_valid() and 'continuer' in request.POST:
return HttpResponse('continuer');
elif ue_form.is_valid() and 'quitter' in request.POST:
return HttpResponse('quitter');
else:
return HttpResponse(ue_form.errors.as_data())
else:
ue = UE.objects.get(code_ue=code);
ue_form = UEForms(instance=ue);
return render(request, 'fely/admin/modifier_ue.html', {'ue_form': ue_form, 'code': code});
ue_form.is_valid()始终为false,并且“ modifier_ue.html”调用视图“ modifier_ue”