开发者

Get image from Flickr using django-syncr

I have my photos located on Flickr. I want to sync them between Flickr and my Django app using django-syncr. It's installed, Flickr section is visible in Admin site. I can sync photo data from Flickr to my local database. In a few words -- it works.

But, I don't understand how to get these data from my database using views.py and template file?I mean, how to make my Flickr's photos visible on my site? I got something like this on my site:

    *  IMG_2467
    *  Morning fog on Halong bay

I used these files but get only title from all data and didn't anything else, including photos.

views.py

from django.shortcuts import render_to_response
from syncr.flickr.models import Photo

def index(request):
    get_photo = Photo.objects.all()
    return render_to_response('index.html', {'get_photo': get_photo})

index.html

<html>
<title>
Test page
</title>
<body>
{% if get_photo %}
<ul>
{% for photo in ge开发者_开发技巧t_photo %}
    <li>{{ photo }}</li>
{% endfor %}
</ul>
{% else %}
<p>No photos are available.</p>
{% endif %}
</body>
</html>


maybe you should add <img src='{{photo.url}}' /> ? I don't see how do you plan to show images if you're just importing the names.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜