diff --git a/django_lostplaces/lostplaces/models/models.py b/django_lostplaces/lostplaces/models/models.py index de31c44..1f163ca 100644 --- a/django_lostplaces/lostplaces/models/models.py +++ b/django_lostplaces/lostplaces/models/models.py @@ -65,27 +65,12 @@ class Explorer(models.Model): def __str__(self): return self.user.username - + @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): - """ - Delete Explorer profile when User gets deleted. - Deletion on profile_pic update is not necessary, as it gets - simply overwritten. - """ if created: Explorer.objects.create(user=instance) -def auto_delete_file_on_delete(sender, instance, **kwargs): - """ - Deletes file (including thumbnails) from filesystem - when corresponding `profile_image` object is deleted. - """ - if instance.profile_image: - # Get and delete all files and thumbnails from instance - thumbmanager = get_thumbnailer(instance.profile_image) - thumbmanager.delete(save=False) - @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.explorer.save()