[FIX] RECRUITMENT: Fixed skill zone create from candidate profile

This commit is contained in:
Horilla
2025-12-25 13:26:00 +05:30
parent 30d57e82c4
commit 30cda6896d
2 changed files with 9 additions and 8 deletions

View File

@@ -1078,11 +1078,7 @@ class SkillZoneCandidateForm(ModelForm):
"""
model = SkillZoneCandidate
fields = "__all__"
exclude = [
"added_on",
"is_active",
]
fields = ["skill_zone_id", "reason"]
def as_p(self, *args, **kwargs):
"""
@@ -1095,11 +1091,9 @@ class SkillZoneCandidateForm(ModelForm):
def clean_candidate_id(self):
candidate_field = self.cleaned_data["candidate_id"]
# Case 1: update (single select → a Candidate object)
if isinstance(candidate_field, Candidate):
return candidate_field
# Case 2: create (multi select → QuerySet/iterable of Candidate)
if hasattr(candidate_field, "__iter__"):
for candidate in candidate_field:
if not isinstance(candidate, Candidate):
@@ -1111,6 +1105,13 @@ class SkillZoneCandidateForm(ModelForm):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.fields["candidate_id"].empty_label = None
self.fields = {
"skill_zone_id": self.fields["skill_zone_id"],
"candidate_id": self.fields["candidate_id"],
"reason": self.fields["reason"],
}
if self.instance.pk:
self.verbose_name = (
self.instance.candidate_id.name

View File

@@ -1,7 +1,7 @@
{% load i18n %}
<div class="d-flex justify-content-between mb-3 me-3 align-items-center">
<span class="oh-activity-sidebar__title fw-bold font-semibold">{{candidate}}{% trans "'s Scheduled Interviews" %}</span>
<span class="oh-activity-sidebar__title fw-bold font-semibold text-sm">{{candidate}}{% trans "'s Skill Zones" %}</span>
<button type="button" hx-get="{% url 'skill-zone-cand-create' candidate.id %}?candidate={{candidate.id}}" title="Schedule Interview" hx-target="#genericModalBody" hx-swap="innerHTML" data-target="#genericModal" class="oh-btn oh-btn--secondary mt-2 mr-0 oh-btn--w-100-resp" data-toggle="oh-modal-toggle">
<ion-icon name="add" class="mr-1 md hydrated" role="img" aria-label="add"></ion-icon>