diff options
author | luxagraf <sng@luxagraf.net> | 2018-03-13 14:06:25 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-03-13 14:06:25 -0500 |
commit | ed3f6a6105958ef130aa5cb96de04a6e2396fbc9 (patch) | |
tree | e066bd9f666eb5bbe04fb855c626a27de2e6c0f8 /app/books | |
parent | 83dd70783a8affeb312854fa50ee4c7f97cf797a (diff) |
fixed book image urls for new uploads
Diffstat (limited to 'app/books')
-rw-r--r-- | app/books/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
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) |