description_fuckery.
This commit is contained in:
parent
3eaa186b66
commit
86cc7f23fe
@ -68,24 +68,9 @@ class Explorer(models.Model):
|
||||
|
||||
@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()
|
||||
|
Loading…
Reference in New Issue
Block a user