我views.py鱈魚沒有屬性:屬性Error對象有cleaned_data
def update_details(request):
if request.method == "POST":
form = UpdateDetailsForm(request.POST)
if form.is_valid:
asset_code=form.cleaned_data['asset_code1']
fd=form.cleaned_data['product_details']
verifications = Verification.objects.filter(asset_code__exact=asset_code)
verifications.update(product_details=fd)
return render_to_response('update_details.html',
{'form':UpdateDetailsForm(),},
context_instance=RequestContext(request))
我想在我的模型更新「product_details」列值,其中資產代碼正好是輸入的內容的用戶。但是當我提交按鈕時出現錯誤。
錯誤消息:
AttributeError的對象沒有屬性 'cleaned_data' django的
重複http://stackoverflow.com/questions/4308527/django-model-form-object-has-no-attribute-cleaned-data – Chandan
@Chandan的 - 不是重複。例外情況相同,但原因不同。 –
我的道歉。看到答案後,我意識到自己的錯誤。 – Chandan