我在试着安装django-照片。一切似乎都好,因为我安装和设置遵循官方的指导方针。我要上传一些照片作为例子。但是,当查看照片或画廊详细信息时,会出现如下错误:
Caught an exception while rendering: 'Photo' object has no attribute 'get_thumbnail_url'我试图从文件photo_detail.html中删除以下代码
{% if object.public_galleries %}
<h2>This photo is found in the following galleries:</h2>
<ol>
{% for gallery in object.public_galleries %}
<li>{%previous_in_gallery object gallery%} <a href="{{ gallery.get_absolute_url }}">{{ gallery.title }}</a> {%next_in_gallery object gallery%}</li>
{% endfor %}
</ol>
{% endif %}没有更多的错误,但是图片不会出现。如果你点击链接仍然会导致正确的照片看。我认为问题在于:
{{ object.get_display_url }}它完全不返回任何价值。请帮我解决这个问题。谢谢!
发布于 2009-10-25 13:38:50
安装后运行python manage.py plinit并选择创建thumbnail和display照片大小吗?需要在数据库中定义这些照片大小。
发布于 2009-10-25 12:56:25
老实说,从源代码来看,它看起来就像是项目中的一个bug。如果使用搜索源,缩略图似乎不是照片类中的字段(get_FIELD_url是访问ImageField的url的一种简单方法)。因此,我建议修改源代码或寻找另一个项目。虽然我可能错了,但这就是我对这个项目的5分钟扫描发现的结果。
发布于 2010-02-20 20:18:07
在其他版本中,您必须编辑photologue/templates/photolog/tags/next_in_gallery.html并替换
{{ photo.get_thumbnail_url }}使用
{{ photo.thumbnail.url }}同样适用于photologue/templates/photolog/tags/prev_in_gallery.html.
https://stackoverflow.com/questions/1620692
复制相似问题