diff options
-rw-r--r-- | app/books/kindleparser.py | 8 | ||||
-rw-r--r-- | app/books/models.py | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/books/kindleparser.py b/app/books/kindleparser.py index c56499e..93edfac 100644 --- a/app/books/kindleparser.py +++ b/app/books/kindleparser.py @@ -108,3 +108,11 @@ class KindleClippingsParser(object): body_markdown=body_markdown ) """ + + + + + + + + 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): |