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)'),