没有名为preview的模块,FormPreview Django Module

时间:2010-07-12 16:21:31

标签: python django

我正在尝试使用表单预览django模块示例。在polls_app / mysite / urls.py中:

from django.conf.urls.defaults import *
from mysite.preview import SomeModelFormPreview
from mysite.forms import SomeModelForm
from django import forms

在polls_app / mysite / SomeModelFormPreview.py中:

from django.contrib.formtools.preview
import FormPreview from mysite.models
import SomeModel

class SomeModelFormPreview (FormPreview):
    def done(self,request,cleaned_data):
        return HttpResponseRedirect("/form/success")

我在这里关注示例:http://docs.djangoproject.com/en/1.2/ref/contrib/formtools/form-preview/#module-django.contrib.formtools

这是我收到的导入错误:

ImportError at / No module named preview Request
Method:    GET
Request URL:    http://127.0.0.1:8000/
Django Version:    1.2.1
Exception Type:    ImportError
Exception Value:     No module named preview
Exception Location:    /home/adam/Desktop/polls_app/mysite/../mysite/urls.py in <module>, line 4 Python
Executable:    /usr/bin/python Python
Version:    2.6.2 Python
Path:    ['/home/adam/Desktop/polls_app/mysite',
            '/usr/lib/python2.6',
            '/usr/lib/python2.6/plat-linux2',
            '/usr/lib/python2.6/lib-tk',
            '/usr/lib/python2.6/lib-old',
            '/usr/lib/python2.6/lib-dynload',
            '/usr/lib/python2.6/dist-packages',
            '/usr/lib/python2.6/dist-packages/PIL',
            '/usr/lib/python2.6/dist-packages/gst-0.10',
            '/var/lib/python-support/python2.6',
            '/usr/lib/python2.6/dist-packages/gtk-2.0',
            '/var/lib/python-support/python2.6/gtk-2.0',
            '/usr/local/lib/python2.6/dist-packages']
Server time:    Mon, 12 Jul 2010 11:16:13 -0500

1 个答案:

答案 0 :(得分:0)

似乎mysite.preview不存在。那是你看到的错误。这可能是循环包含或名称不正确的结果。