定义FormView派生类时:
class PrefsView(FormView):
template_name = "prefs.html"
form_class = MyForm # What's wrong with this?
def get(self,request):
context = self.get_context_data()
context['pagetitle'] = 'My special Title'
context['form'] = MyForm # Why Do I have to write this?
return render(self.request,self.template_name,context)
Run Code Online (Sandbox Code Playgroud)
我预计context['form'] = MyForm
不需要该行,因为form_class
已定义,但没有它{{ form }}
不会传递给模板.
我做错了什么?
这是一种非常奇怪的wget
行为.我在debian 7.2上.
wget -r -O - www.blankwebsite.com
Run Code Online (Sandbox Code Playgroud)
永远挂起来.我的意思是它挂起,它不是通过互联网搜索,我可以验证它strace
.如果我这样做:
while read R
do
wget -r -O - www.blankwebsite.com
done < smallfile
Run Code Online (Sandbox Code Playgroud)
如果smallfile
包含一行,则命令会在几秒钟后退出.
我也尝试过
wget -r -O - localhost/test.html
Run Code Online (Sandbox Code Playgroud)
用空test.html
文件,结果相同.对我来说,这听起来像一个bug.
一切都正常运行变化-O -
具有-O myfile
或删除-r
.
我用过-O -
是因为我把输出传递给了grep
.
谁能解释一下呢?你见过类似的东西吗?