我试图将一个表单传递给django中的ListView来创建一个新对象
有办法吗? (我知道如何用def代替class来实现这一点)
Im使用django 2.0、python3.4
这是ListView:
class CustomerListView(ListView):
template_name = 'customers/table_customers.html'
context_object_name = 'items'
def get_queryset(self):
return Customer.objects.all()
def get_context_data(self, **kwargs):
context = super(CustomerListView, self).get_context_data(**kwargs)
context['form'] = CustomerForm
return context
我可以看到页面中的表单,但是当我点击“提交”时,我从服务器得到405响应:“methodnotallowed(POST):/customers/customer/”。在
这是表格:
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐