From 07fe1bc3ca81defd4c03512470e5ea3dda9ddb19 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Thu, 24 Dec 2020 17:23:20 +0100 Subject: [PATCH] Rename place_image_path function. --- django_lostplaces/lostplaces/models/place.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django_lostplaces/lostplaces/models/place.py b/django_lostplaces/lostplaces/models/place.py index 588696f..8fc6790 100644 --- a/django_lostplaces/lostplaces/models/place.py +++ b/django_lostplaces/lostplaces/models/place.py @@ -49,10 +49,10 @@ class Place(Submittable, Taggable, Mapable): return self.name -def generate_image_upload_path(instance, filename): +def generate_place_image_filename(instance, filename): """ - Callback for generating path for uploaded images. - Returns filename as: place_pk-placename{-rnd_string}.jpg + Callback for generating filename for uploaded place images. + Returns filename as: place_pk-placename{-number}.jpg """ return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1] @@ -84,7 +84,7 @@ class PlaceImage (PlaceAsset): verbose_name=_('Description'), ) filename = ThumbnailerImageField( - upload_to=generate_image_upload_path, + upload_to=generate_place_image_filename, resize_source=dict(size=(2560, 2560), sharpen=True), verbose_name=_('Filename(s)'),