From aa7bc766ac27c669162bf903711c54f74f3758b1 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 15 May 2013 13:02:24 -0400 Subject: fixed image thumbnails, expanded body text entry field, switched map to OSM and added the ability to associate asides with an entry -- still need to add javascript to dynamically create asides. --- app/blog/widgets.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'app/blog/widgets.py') diff --git a/app/blog/widgets.py b/app/blog/widgets.py index a9451e7..e7d9da8 100644 --- a/app/blog/widgets.py +++ b/app/blog/widgets.py @@ -5,15 +5,10 @@ from django.conf import settings from PIL import Image import os -try: - from sorl.thumbnail.main import DjangoThumbnail - def thumbnail(image_path): - t = DjangoThumbnail(relative_source=image_path, requested_size=(200,200)) - return u'%s' % (t.absolute_url, image_path) -except ImportError: - def thumbnail(image_path): - absolute_url = os.path.join(settings.IMAGES_URL, image_path) - return u'%s' % (absolute_url, image_path) +def thumbnail(image_path): + absolute_url = os.path.join(settings.IMAGES_URL, image_path[7:]) + print absolute_url + return u'%s' % (absolute_url, image_path) class AdminImageWidget(AdminFileWidget): """ @@ -25,8 +20,7 @@ class AdminImageWidget(AdminFileWidget): file_name = str(value) if file_name: file_path = '%s' % (file_name) - output.append('%s
%s %s
%s ' % \ - (file_path, thumbnail(file_name), _('Currently:'), file_path, file_name, _('Change:'))) + output.append('%s' % (file_path, thumbnail(file_name))) output.append(super(AdminFileWidget, self).render(name, value, attrs)) return mark_safe(u''.join(output)) -- cgit v1.2.3-70-g09d2