Merge pull request #177 from rafiqhilali/avatar-deletion-storage-bug

Avatar storage deletion bug
This commit is contained in:
Grant McConnaughey 2020-01-04 11:41:27 -06:00 committed by GitHub
commit ce56f6a104
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,7 +215,8 @@ def remove_avatar_images(instance=None, **kwargs):
for size in settings.AVATAR_AUTO_GENERATE_SIZES:
if instance.thumbnail_exists(size):
instance.avatar.storage.delete(instance.avatar_name(size))
instance.avatar.storage.delete(instance.avatar.name)
if instance.avatar.storage.exists(instance.avatar.name):
instance.avatar.storage.delete(instance.avatar.name)
signals.post_save.connect(create_default_thumbnails, sender=Avatar)