[UPDT] GENERAL: get_avatar method updates
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user