Rename place_image_path function.

This commit is contained in:
Marcus Scholz 2020-12-24 17:23:20 +01:00
parent d04e986419
commit 07fe1bc3ca

View File

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