diff --git a/recruitment/models.py b/recruitment/models.py index af3f22b81..b8dbbf80e 100644 --- a/recruitment/models.py +++ b/recruitment/models.py @@ -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): """