Django 表单向导,SessionWizardView 导入错误
我想实现一个 django 表单向导。我阅读了有关它的文档,但是当我添加这 'from django.contrib.formtools.wizard.views' import SessionWizardView' 到我的视图,我得到 “没有名为视图的模块”。
我从 shell 中搜索了“视图”,但没有,formtools 下没有视图模块。
有什么想法吗?
I want to implement a django form wizard. I read the documentation about it but when I add the
'from django.contrib.formtools.wizard.views' import SessionWizardView' to my view, i get
"No module named views" .
I searched the "views" from shell, but nope there is no view module under the formtools.
Any idea ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您位于错误的文档页面 - 您链接的页面是当前开发主干的文档,可能您正在使用 Django 1.3:
https://docs.djangoproject.com/en/1.3/ref/contrib/formtools/form-wizard/
You are on the wrong documentation page - the page you link is the documentation of the current development trunk, probably you're using Django 1.3:
https://docs.djangoproject.com/en/1.3/ref/contrib/formtools/form-wizard/
我正在回答,因为所选答案中的链接不再可用 - 原因是对
django
版本1.3
(也是1.4
)的支持已停产。根据最新的
django 1.8
(1.9
处于 dev/alpha 模式),django.contrib.formtools.wizard.views
已被弃用。移植 django 项目会出现 No module named formtools.wizard.views - from django.contrib.formtools.wizard.views import SessionWizardView 异常。
解决方案:对于
Linux
用户 - 如果您不是root
用户,请使用sudo
将应用的导入语句更改为引用新包:
from django.contrib.formtools.wizard.views import SessionWizardView
到from formtools.wizard.views import SessionWizardView
I am answering, as the link in the selected answer is no more available - reason being, the support for
django
version1.3
(also1.4
) has been discontinued.As per latest
django 1.8
(1.9
is in dev/alpha mode) thedjango.contrib.formtools.wizard.views
has been deprecated.Porting your django project gives you No module named formtools.wizard.views - from django.contrib.formtools.wizard.views import SessionWizardView exception.
Solution: For
Linux
users - usesudo
in case you're notroot
userChange your app’s import statements to reference the new packages:
from django.contrib.formtools.wizard.views import SessionWizardView
tofrom formtools.wizard.views import SessionWizardView