- 论坛徽章:
- 0
|
本帖最后由 tz104 于 2013-07-18 11:23 编辑
django 1.5
python 2.6.5
模仿着django step by step:http://www.lhelper.org/dev/djang ... test/doc/tut07.html 的例子学习
在例子“创建通讯录”中,遇到了报错,如下:
TypeError at /address/
__init__() takes exactly 1 non-keyword argument (2 given)
Request Method: GET
Request URL: http://192.168.1.111:8080/address/
Django Version: 1.5.1
Exception Type: TypeError
Exception Value:
__init__() takes exactly 1 non-keyword argument (2 given)
Exception Location: /usr/lib/python2.6/site-packages/django/core/handlers/base.py in get_response, line 115
Python Executable: /usr/bin/python
Python Version: 2.6.5
Python Path:
['/opt/Django_Pro',
'/opt/Django_Pro/Django_Pro',
'/opt/Django_Pro',
'/usr/lib/python2.6/site-packages/distribute-0.6.49-py2.6.egg',
'/usr/lib/python26.zip',
'/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/site-packages',
'/usr/lib/python2.6/site-packages/gtk-2.0'
不知如何破?
address下的urs.py如下:
from django.conf.urls import *
from django.views.generic.list import ListView
from address.models import Address
info_dict = {
'queryset': Address.objects.all(),
}
urlpatterns = patterns('',
url(r'^/?$','django.views.generic.list.ListView',info_dict),
)
|
|