mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-14 19:36:24 +00:00
remove leftover of avatar generator (#1366)
This commit is contained in:
parent
35d37e6328
commit
6f4989cbf6
@ -88,25 +88,5 @@ class Robot(models.Model):
|
|||||||
def save_user_robot(sender, instance, **kwargs):
|
def save_user_robot(sender, instance, **kwargs):
|
||||||
instance.robot.save()
|
instance.robot.save()
|
||||||
|
|
||||||
@receiver(pre_delete, sender=User)
|
|
||||||
def del_avatar_from_disk(sender, instance, **kwargs):
|
|
||||||
try:
|
|
||||||
avatar_file = Path(
|
|
||||||
settings.AVATAR_ROOT + instance.robot.avatar.url.split("/")[-1]
|
|
||||||
)
|
|
||||||
avatar_file.unlink()
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.username
|
return self.user.username
|
||||||
|
|
||||||
# to display avatars in admin panel
|
|
||||||
def get_avatar(self):
|
|
||||||
if not self.avatar:
|
|
||||||
return settings.STATIC_ROOT + "unknown_avatar.png"
|
|
||||||
return self.avatar.url
|
|
||||||
|
|
||||||
# method to create a fake table field in read only mode
|
|
||||||
def avatar_tag(self):
|
|
||||||
return mark_safe('<img src="%s" width="50" height="50" />' % self.get_avatar())
|
|
||||||
|
Loading…
Reference in New Issue
Block a user