Django render_to_response报错pop expected at least 1 arguments, got 0

7893阅读 0评论2012-12-21 sunisD0wn
分类:系统运维

此blog意在记录解决学习开发中遇到的问题,您看到这篇blog可能意味着您也遇见类似问题,如果这篇文章对您没有帮助,能否请您在留言中说下您的问题,不胜感激。

TypeError at /testnetwork/ pop expected at least 1 arguments, got 0
Request Method: GET
Request URL:
Django Version: 1.4
Exception Type: TypeError
Exception Value: pop expected at least 1 arguments, got 0




  1. form = HostForm()
  2. form.fields['ips_ranges'].choices = RANGE_CHOICE
  3. form.fields['ranges_subnet'].choices = SUBNET_CHOICE
  4. form.fields['subnet_network'].choices = NETWORK_CHOICE
  5. context['form']=form

return render_to_response('testnetwork.html', {'networks':networks},context)


问题所在:
 passing in three parameters to render_to_response. The third one is expected to be an instance of Context (see https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#django.shortcuts.render_to_response), but you're passing in a dictionary.



解决方法

-form = HostForm()
|-form.fields['ips_ranges'].choices = RANGE_CHOICE
|-form.fields['ranges_subnet'].choices = SUBNET_CHOICE
|-form.fields['subnet_network'].choices = NETWORK_CHOICE
|-context['form']=form
|-context['networks'] = networks

|-return render_to_response('testnetwork.html',context)


上一篇:Django form表单中forms.TypedChoiceField choices动态赋值
下一篇:Linux 环境变量修改