您的位置:首页 > 移动开发 > Objective-C

Generic detail view DetailView must be called with either an object pk or a slug.

2014-04-03 15:22 721 查看
解决办法

[code] url(r'^(?P<poll_id>\d+)/$',-$                                               
 url(r'^(?P<poll_id>\d+)/results/$',-$


This is the correct core:

[code] url(r'^(?P<pk>\d+)/$',-$                                               
 url(r'^(?P<pk>\d+)/results/$',-$

把URL捕获的组名称改为pk

参照:
http://stackoverflow.com/questions/12304050/django-tutorial-generic-views-attribute-error
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: