Rename place_image_path function.
This commit is contained in:
parent
d04e986419
commit
07fe1bc3ca
@ -49,10 +49,10 @@ class Place(Submittable, Taggable, Mapable):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
def generate_image_upload_path(instance, filename):
|
def generate_place_image_filename(instance, filename):
|
||||||
"""
|
"""
|
||||||
Callback for generating path for uploaded images.
|
Callback for generating filename for uploaded place images.
|
||||||
Returns filename as: place_pk-placename{-rnd_string}.jpg
|
Returns filename as: place_pk-placename{-number}.jpg
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1]
|
return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1]
|
||||||
@ -84,7 +84,7 @@ class PlaceImage (PlaceAsset):
|
|||||||
verbose_name=_('Description'),
|
verbose_name=_('Description'),
|
||||||
)
|
)
|
||||||
filename = ThumbnailerImageField(
|
filename = ThumbnailerImageField(
|
||||||
upload_to=generate_image_upload_path,
|
upload_to=generate_place_image_filename,
|
||||||
resize_source=dict(size=(2560, 2560),
|
resize_source=dict(size=(2560, 2560),
|
||||||
sharpen=True),
|
sharpen=True),
|
||||||
verbose_name=_('Filename(s)'),
|
verbose_name=_('Filename(s)'),
|
||||||
|
Loading…
Reference in New Issue
Block a user