diff options
author | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-03-13 19:34:03 +0000 |
---|---|---|
committer | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-03-13 19:34:03 +0000 |
commit | 9aa6fa7cf6cb10103de9284e26db7e68b039a0b7 (patch) | |
tree | 6c89094d3ff8ed036d0e91173c2b23826b50e642 /apps | |
parent | 9dcc9b71adc118abb1f3191bd9753c9e97c839cb (diff) |
fixed photo importing tools
Diffstat (limited to 'apps')
-rw-r--r-- | apps/blog/views.py | 5 | ||||
-rw-r--r-- | apps/photos/admin.py | 4 | ||||
-rw-r--r-- | apps/photos/models.py | 3 | ||||
-rw-r--r-- | apps/photos/utils.py | 11 | ||||
-rw-r--r-- | apps/photos/views.py | 2 |
5 files changed, 16 insertions, 9 deletions
diff --git a/apps/blog/views.py b/apps/blog/views.py index ef933eb..bd583df 100644 --- a/apps/blog/views.py +++ b/apps/blog/views.py @@ -7,6 +7,7 @@ from django.http import Http404 from blog.models import Entry, Topic from locations.models import Region, Country +from photos.models import Photo def home(request): featured = Entry.objects.filter(status__exact=1).latest() @@ -19,8 +20,8 @@ def home(request): def entry_detail(request, year, month, day, slug): obj = get_object_or_404(Entry, slug__exact=slug) photos = {} - if obj.photo_gallery: - photos = Photo.objects.filter(set__exact=obj.get().photo_gallery.id)[:9] + #if obj.photo_gallery: + # photos = Photo.objects.filter(set__exact=obj.get().photo_gallery.id)[:9] extra = {'photos':photos,} return render_to_response('details/entry.html', {'object': obj,'photos':photos}, context_instance=RequestContext(request)) diff --git a/apps/photos/admin.py b/apps/photos/admin.py index 3cc1ae8..0a6014f 100644 --- a/apps/photos/admin.py +++ b/apps/photos/admin.py @@ -55,10 +55,10 @@ admin.site.register(Photo, PhotoAdmin) class PhotoGalleryAdmin(OSMGeoAdmin): - list_display = ('set_title','region','location') + list_display = ('set_title','region','location','pub_date') list_filter = ('region','location') fieldsets = ( - (None, {'fields': (('set_id','set_title', 'set_desc'),'set_slug','primary','location','region')}), + (None, {'fields': (('set_id','set_title', 'set_desc'),'set_slug','primary','location','region','photos','pub_date')}), ) diff --git a/apps/photos/models.py b/apps/photos/models.py index a157c6e..f1d9f54 100644 --- a/apps/photos/models.py +++ b/apps/photos/models.py @@ -135,9 +135,10 @@ class PhotoGallery(models.Model): photos = models.ManyToManyField(Photo) location = models.ForeignKey(Location, null=True) region = models.ForeignKey(Region, null=True) + pub_date = models.DateTimeField(null=True) class Meta: - ordering = ('id',) + ordering = ('-pub_date','id') verbose_name_plural = 'Photo Galleries' def __unicode__(self): diff --git a/apps/photos/utils.py b/apps/photos/utils.py index 57a4cdb..9fe69ba 100644 --- a/apps/photos/utils.py +++ b/apps/photos/utils.py @@ -54,6 +54,8 @@ def sync_flickr_photos(*args, **kwargs): dupe = True print 'already have '+info['id']+' moving on' except ObjectDoesNotExist: + #for debugging: + print info['title'] taglist = [] location, region = get_geo(float(info['latitude']),float(info['longitude'])) details = client.flickr_photos_getInfo(user_id=settings.FLICKR_USER_ID, photo_id=force_unicode(info['id'])) @@ -86,7 +88,8 @@ def sync_flickr_photos(*args, **kwargs): ) #print info['title'], region, location photo.save() - #make_local_size(photo) + make_local_copies(photo) + slideshow_image(photo) def exif_handler(data): converted = {} @@ -137,7 +140,7 @@ def slideshow_image(photo): cur_width, cur_height = img.size #if image landscape if cur_width > cur_height: - new_width = 800 + new_width = 1000 #check to make sure we aren't upsizing if cur_width > new_width: ratio = float(new_width)/cur_width @@ -257,8 +260,10 @@ def sync_sets(*args, **kwargs): set_slug = slugify(force_unicode(post.findtext('title'))), primary = force_unicode(info['primary']), ) - get_photos_in_set(s) + #create the gallery thumbnail image: + photo = Photo.objects.get(flickr_id__exact=str(info['primary'])) + make_gallery_thumb(photo,s) def get_photos_in_set(set): BASE_PATH = 'http://flickr.com/services/rest/' diff --git a/apps/photos/views.py b/apps/photos/views.py index 5967333..a81feea 100644 --- a/apps/photos/views.py +++ b/apps/photos/views.py @@ -18,7 +18,7 @@ def potd_list(request): def gallery_list(request,page): request.page_url = '/photos/%d/' request.page = int(page) - qs = PhotoGallery.objects.all().order_by('-id') + qs = PhotoGallery.objects.all() return object_list(request, queryset=qs, template_name='archives/photos.html') def gallery(request,slug): |