与分页相关的Django缩进错误

2024-09-29 23:29:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我按照教程使用python安装django的分页设置。当我试图在视图.py当我试图加载相关模板时,我收到一个“识别错误”。在

我可以在不声明分页器的情况下进行分页视图.py,但我想自定义页面设置。在

我在我的视图.py我相信我在我的设置.py文件夹。我知道我没有把声明打错,因为它只是一句简单的话:

c = RequestContext(request, { "test": testObj, })

p = Paginator (testObj, 100)

return HttpResponse(t.render(c))

是什么导致了这个错误?在

错误:

IndentationError at /result/

unexpected indent (views.py, line 90)

Request Method:     GET
Request URL:    http://127.0.0.1:8000/result/xxx
Django Version:     1.5
Exception Type:     IndentationError
Exception Value:    

unexpected indent (views.py, line 90)

Exception Location:     C:\Python27\lib\site-packages\django\utils\importlib.py in import_module, line 35
Python Executable:  C:\Python27\python.exe
Python Version:     2.7.3
Python Path:    

['C:\\Users\\xxx\\Desktop\\xxx',
 'C:\\Python27\\lib\\site-packages\\django_pagination-1.0.7-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages']

Server time:    Fri, 22 Mar 2013 14:38:29 -0400

Tags: djangopy视图声明libpackages错误line

热门问题