views:

163

answers:

3

Hello guys, 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 get_photo %}
    <li>{{ photo }}</li>
{% endfor %}
</ul>
{% else %}
<p>No photos are available.</p>
{% endif %}
</body>
</html>
A: 

Did you solve this yet? I don't see anything wrong with that code, did you add it to the list of installed apps in settings.py?

Jasper Kennis
A: 

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.

DevAno1
A: 

Its own site there is an example, but i don't know how to use it. I want to use django-syncr.

from syncr.app.flickr import FlickrSyncr
f = FlickrSyncr(API_KEY, API_SECRET)

f.syncRecentPhotos('username', days=7)
f.syncPublicFavorites('username')

http://code.google.com/p/django-syncr/

Cango