summaryrefslogtreecommitdiff
path: root/app/books/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/books/models.py')
-rw-r--r--app/books/models.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/books/models.py b/app/books/models.py
index 2ef9716..c003b25 100644
--- a/app/books/models.py
+++ b/app/books/models.py
@@ -93,14 +93,14 @@ class Book(models.Model):
super(Book, self).save()
-#@receiver(post_save, sender=Book)
+@receiver(post_save, sender=Book)
def post_save_events(sender, update_fields, created, instance, **kwargs):
if instance.image:
base_path = "%s/%s/" % (settings.MEDIA_ROOT, "/".join(str(i) for i in instance.image.name.split('/')[:-1]))
filename, file_extension = os.path.splitext(instance.image.path)
img = Image.open(instance.image.path)
- resize_image(img, None, 160, 78, base_path, "%s_tn%s" % (filename.split('/')[-1], file_extension))
- resize_image(img, None, 650, 78, base_path, "%s_small%s" % (filename.split('/')[-1], file_extension))
+ resize_image(img, None, 160, 78, "%s%s_tn%s" % (base_path, filename.split('/')[-1], file_extension))
+ resize_image(img, None, 650, 78, "%s%s_small%s" % (base_path, filename.split('/')[-1], file_extension))
class BookHighlight(models.Model):