大家好,我在这一个挣扎,谷歌搜索这一个核心。在
我正在开发一个图像库,每个相册都有输出,当单击屏幕覆盖显示图像库。为了在图库中显示每个图像,我们在javascript中做了大量的工作,因此我只需要图像路径,该路径由:
{{ images.content }}
以下是我在django项目中使用的文件。在
这方面的帮助太棒了。在
在管理.py在
^{pr2}$在视图.py在
from django.http import HttpResponse
from notices.models import Notices
from django.shortcuts import get_object_or_404
from django.shortcuts import render_to_response
from gallery.models import *
from navigation.models import *
# when the galleries page is requested, all image galleries are listed by date created with the latest first,
# each gallery displayed contains a javascript tag containing an index of images separated by ';'
def galleries(request):
gallery = Gallerys.objects.all()
images = Images.objects.all()
return render_to_response('galleries.html', {'Galleries': gallery, 'Images': images})
在图库.html在
{% for galleries in Galleries %}
<h1>{{ galleries.title }}</h1>
{% for images in galleries.gallery.all %}
<h2>{{ images.content }}</h2>
{% empty %}
none
{% endfor %}
{% endfor %}
当我迭代:
<h2>{{ images.content }}</h2>
我什么都没得到,我哪里出错了?在
谢谢!在
在
Galleries
对象中没有名为gallery
的属性。在用户默认的反向m2m访问器
images_set
相关问题 更多 >
编程相关推荐