From ed3f6a6105958ef130aa5cb96de04a6e2396fbc9 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Tue, 13 Mar 2018 14:06:25 -0500 Subject: fixed book image urls for new uploads --- app/books/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/books') diff --git a/app/books/models.py b/app/books/models.py index 59f0ae3..ef6a9b6 100644 --- a/app/books/models.py +++ b/app/books/models.py @@ -10,7 +10,7 @@ from utils.widgets import markdown_to_html def get_upload_path(self, filename): - return "images/book-covers/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename) + return "images/book-covers/%s" % (filename) class Book(models.Model): @@ -49,7 +49,7 @@ class Book(models.Model): return reverse("books:detail", kwargs={"slug": self.slug}) def get_image_url(self): - return '%sbook-covers/%s.jpg' % (settings.IMAGES_URL, self.slug) + return '%sbook-covers/%s' % (settings.IMAGES_URL, self.image.name.split('/')[-1]) def get_rating(self): return int(self.rating) -- cgit v1.2.3-70-g09d2