当我点击链接到上述视图的按钮时,发生错误
以下是我看法
def change_company(request,pk):
item = get_object_or_404(Companies, pk=pk)
if request.method == "POST":
form = CompaniesForm(request.POST, instance=item)
if form.is_valid():
form.save()
return redirect('display_companies')
else:
form = CompaniesForm(instance=item)
return render(request, 'change_company.html', {'form':form})
错误:
视图companies. views. change_company没有返回HttpResponse对象,而是返回None。
1条答案
按热度按时间zzlelutf1#
将您的函数更改为: