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 |
- 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
问题所在:
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)