我正在将 Django 表单数据渲染到模板,但是每次我访问 url 时,它都会向我显示这个错误:
_wrapped_view() takes at least 1 argument (0 given)
views.py 中的方法:
@login_required
def subnet_network_detail(request):
if request.method == 'POST':
form = NetworkCreateForm(request.POST)
if form.is_valid():
subnet = form.data['Subnet_Address']
ip = form.data['IP_Address']
user_hosts = get_hosts(user=request.user)
hosts_list = host_subnet(user_hosts,subnet,ip)
import pdb;pdb.set_trace()
extra_context = {
'hosts_list': hosts_list
}
return direct_to_template(request, 'networks/subnet_network.html',extra_context)
和 urls.py:
url(r'^network/netmask/select/$',
'subnet_network_detail', name='subnet_network_detail')
我从其他有关此错误的问题中读到,但没有任何想法。如何解决?