Django ViewDoesNotExist error

版本问题

引文:http://stackoverflow.com/questions/16110659/django-viewdoesnotexist-error-after-installing-photologue

 

I'm using Django 1.5.1. Everything was OK. But as soon as I installed django-photologue through pip I face this error when I visit admin url:

>**ViewDoesNotExist at /admin/**  
Could not import django.views.generic.list_detail.object_list. Parent module django.views.generic.list_detail does not exist.  
Request Method: GET  
Request URL:    http://localhost:8000/admin/  
Django Version: 1.5.1  
Exception Type: ViewDoesNotExist  
Exception Value:      
Could not import django.views.generic.list_detail.object_list. Parent module   django.views.generic.list_detail does not exist.  
Exception Location: /usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py in get_callable, line 104  
Python Executable:  /usr/bin/python  
Python Version: 2.7.3  

Also when I run syncdb, photologue sync with database without any error and I can import it in shell.

Any idea about how can I solve this error?

  

2 Answers

up vote 1 down vote accepted

django-photologue was most likely built for an older version of Django. Looks like the newer version of Django isn't friendly with generic views and prefers class based views instead.

Downloading a fresh copy of Django 1.5.1 shows the following:http://f.cl.ly/items/0k1J261S2J2f3k3C110I/Image%202013.04.20%203%3A44%3A39%20AM.png

Whereas Django 1.4.2 shows:http://f.cl.ly/items/152J2U050X0z1j1n0v0D/Image%202013.04.20%203%3A46%3A49%20AM.png

Simply put, the newer version of Django removed the list_detail file.


  
 

to replace the file in the directory urls.py photologue :

"django.views.generic.date_based"and"django.views.generic.list_detail" on "django.views.generic"

"object_list" on "list.ListView"

"object_detail" on "detail.DetailView"

"archive_year" on "dates.YearArchiveView"

"archive_month" on "dates.MonthArchiveView"

"archive_day" on "dates.DayArchiveView"

like this :)

转载于:https://www.cnblogs.com/michaely/p/3337738.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值