[FIX] RECRUITMENT: Fixed candidate profile image placeholder making issue while saving the candidate details

This commit is contained in:
Horilla
2025-12-16 12:15:10 +05:30
parent 9584b2ffba
commit 011996f165

View File

@@ -17,6 +17,7 @@ from django.core.exceptions import ValidationError
from django.core.files.storage import default_storage
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.templatetags.static import static
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
@@ -510,16 +511,9 @@ class Candidate(HorillaModel):
"""
Method will rerun the api to the avatar or path to the profile image
"""
url = (
f"https://ui-avatars.com/api/?name={self.get_full_name()}&background=random"
)
if self.profile:
full_filename = self.profile.name
if default_storage.exists(full_filename):
url = self.profile.url
return url
if self.profile and default_storage.exists(self.profile.name):
return self.profile.url
return static("images/ui/default_avatar.jpg")
def get_company(self):
"""