我是Django的新手,我想获取Checkbox值,我使用getlist()方法获取值iit获取值但是如果我将值传递给数据重新生成代码则显示一些“类型错误”我不明白为什么会出现这个错误...代码在下面
Views.py
def edit_estimate_def(request):
context_csrf = RequestContext(request)
value = request.POST.getlist('inputs')
create_estt = create_est.objects.filter(id = value)
#----- Here only I got The Error, the above line it shows Type Error
int() argument must be a string or a number, not 'list'
context = {'create_estt': create_estt}
if request.method == 'POST':
introductory_paragraph = request.POST.get('introductory_paragraph')
editable_signture_area = request.POST.get('editable_signature_area')
statement_of_needs = request.POST.get('statement_of_needs')
inline_checkboxes = request.POST.get('inline_checkboxes')
weeks = request.POST.get('weeks')
payment_terms = request.POST.get('payment_terms')
create_est.objects.filter
(project_title =value).
update(introductory_paragraph=introductory_paragraph,
editable_signture_area=editable_signture_area, statement_of_need$
return render_to_response('accounts/edit_estimate.html', context,context_csrf)
答案 0 :(得分:1)