summaryrefslogtreecommitdiff
path: root/app/photos
diff options
context:
space:
mode:
Diffstat (limited to 'app/photos')
-rw-r--r--app/photos/models.py3
-rw-r--r--app/photos/views.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/app/photos/models.py b/app/photos/models.py
index 0e5b0e4..5a7bff1 100644
--- a/app/photos/models.py
+++ b/app/photos/models.py
@@ -95,6 +95,9 @@ class LuxImage(models.Model):
if size.width and size.width <= 820 or size.height and size.height <= 800:
return self.get_image_by_size(size.name)
+ def get_admin_insert(self):
+ return "/media/images/%s/%s_tn.%s" % (self.pub_date.strftime("%Y"), self.get_image_name(), self.get_image_ext())
+
def get_largest_image(self):
t = []
for size in self.sizes.all():
diff --git a/app/photos/views.py b/app/photos/views.py
index 0d51c8e..6f2d118 100644
--- a/app/photos/views.py
+++ b/app/photos/views.py
@@ -81,10 +81,9 @@ def photo_preview_json(request, pk):
def thumb_preview_json(request, pk):
p = LuxImage.objects.get(pk=pk)
- thumb = p.get_image_by_size("tn")
+ thumb = p.get_admin_insert()
data = {}
data['url'] = thumb[22:]
-
data = json.dumps(data)
return HttpResponse(data)