summaryrefslogtreecommitdiff
path: root/app/photos
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-06-04 20:37:04 -0500
committerluxagraf <sng@luxagraf.net>2018-06-04 20:37:04 -0500
commit9f8a44a403d511921b28d1ee120181497e09ec53 (patch)
treef876e2ba6b18bd96e01e6976e26dc083d1dd38c0 /app/photos
parent5a3d3d2e9d2ab67218144f7c2e35d70f47f9ad93 (diff)
fixed a bug in URL scheme
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)