[UPDT] GENERAL: get_avatar method updates

This commit is contained in:
Horilla
2024-10-10 11:40:53 +05:30
parent c884bc953e
commit f42ac1a391
3 changed files with 3 additions and 4 deletions

View File

@@ -198,8 +198,7 @@ class Employee(models.Model):
f"https://ui-avatars.com/api/?name={self.get_full_name()}&background=random"
)
if self.employee_profile:
full_filename = settings.MEDIA_ROOT + self.employee_profile.name
full_filename = self.employee_profile.name
if default_storage.exists(full_filename):
url = self.employee_profile.url
return url

View File

@@ -219,7 +219,7 @@ class LeaveType(HorillaModel):
"""
url = f"https://ui-avatars.com/api/?name={self.name}&background=random"
if self.icon:
full_filename = settings.MEDIA_ROOT + self.icon.name
full_filename = self.icon.name
if default_storage.exists(full_filename):
url = self.icon.url

View File

@@ -463,7 +463,7 @@ class Candidate(HorillaModel):
f"https://ui-avatars.com/api/?name={self.get_full_name()}&background=random"
)
if self.profile:
full_filename = settings.MEDIA_ROOT + self.profile.name
full_filename = self.profile.name
if default_storage.exists(full_filename):
url = self.profile.url