summaryrefslogtreecommitdiff
path: root/app/blog/widgets.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2013-05-15 13:02:24 -0400
committerluxagraf <sng@luxagraf.net>2013-05-15 13:02:24 -0400
commitaa7bc766ac27c669162bf903711c54f74f3758b1 (patch)
tree80b6ef1b87f5005171fddda5349959226fd2b930 /app/blog/widgets.py
parentccc6f1af97e2630eb9b5a9b043f308030e61fdbc (diff)
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.
Diffstat (limited to 'app/blog/widgets.py')
-rw-r--r--app/blog/widgets.py16
1 files changed, 5 insertions, 11 deletions
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'<img src="%s" alt="%s" />' % (t.absolute_url, image_path)
-except ImportError:
- def thumbnail(image_path):
- absolute_url = os.path.join(settings.IMAGES_URL, image_path)
- return u'<img src="%s" alt="%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'<img style="max-width: 400px" src="%s" alt="%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('<a target="_blank" href="%s">%s</a><br />%s <a target="_blank" href="%s">%s</a><br />%s ' % \
- (file_path, thumbnail(file_name), _('Currently:'), file_path, file_name, _('Change:')))
+ output.append('<a target="_blank" href="%s">%s</a>' % (file_path, thumbnail(file_name)))
output.append(super(AdminFileWidget, self).render(name, value, attrs))
return mark_safe(u''.join(output))