diff options
Diffstat (limited to 'apps/photos')
-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 |
4 files changed, 13 insertions, 7 deletions
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): |