added the hiring agency and source models

This commit is contained in:
Faheed 2025-10-05 19:47:08 +03:00
parent ede6b2760b
commit 2a9121e7d0
7 changed files with 87 additions and 5 deletions

Binary file not shown.

View File

@ -32,11 +32,11 @@ class JobPostingAdmin(ModelAdmin):
list_display = ('title','description','qualifications')
@admin.register(models.Job)
class JobAdmin(ModelAdmin):
list_display = ('title', 'is_published', 'posted_to_linkedin', 'created_at')
list_filter = ('is_published', 'posted_to_linkedin')
search_fields = ('title', 'description_en', 'description_ar')
# @admin.register(models.Job)
# class JobAdmin(ModelAdmin):
# list_display = ('title', 'is_published', 'posted_to_linkedin', 'created_at')
# list_filter = ('is_published', 'posted_to_linkedin')
# search_fields = ('title', 'description_en', 'description_ar')
# @admin.action(description="Parse selected resumes")
# def parse_resumes(modeladmin, request, queryset):

View File

@ -0,0 +1,43 @@
# Generated by Django 5.2.7 on 2025-10-05 16:46
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruitment', '0014_source_jobposting_source'),
]
operations = [
migrations.CreateModel(
name='HiringAgency',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200, unique=True, verbose_name='Agency Name')),
('contact_person', models.CharField(blank=True, max_length=150, verbose_name='Contact Person')),
('email', models.EmailField(blank=True, max_length=254)),
('phone', models.CharField(blank=True, max_length=20)),
('website', models.URLField(blank=True)),
('notes', models.TextField(blank=True, help_text='Internal notes about the agency')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Hiring Agency',
'verbose_name_plural': 'Hiring Agencies',
'ordering': ['name'],
},
),
migrations.AddField(
model_name='candidate',
name='submitted_by_agency',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='submitted_candidates', to='recruitment.hiringagency', verbose_name='Submitted by Agency'),
),
migrations.AddField(
model_name='jobposting',
name='hiring_agency',
field=models.ForeignKey(blank=True, help_text='External agency responsible for sourcing candidates for this role', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='jobs', to='recruitment.hiringagency', verbose_name='Hiring Agency'),
),
]

View File

@ -112,6 +112,16 @@ class JobPosting(Base):
help_text="The system or channel from which this job posting originated or was first published."
)
hiring_agency = models.ForeignKey(
'HiringAgency',
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='jobs',
verbose_name=_('Hiring Agency'),
help_text=_("External agency responsible for sourcing candidates for this role")
)
class Meta:
ordering = ['-created_at']
verbose_name = "Job Posting"
@ -203,6 +213,16 @@ class Candidate(Base):
weaknesses = models.TextField(blank=True)
criteria_checklist = models.JSONField(default=dict, blank=True)
submitted_by_agency = models.ForeignKey(
'HiringAgency',
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='submitted_candidates',
verbose_name=_('Submitted by Agency')
)
class Meta:
verbose_name = _('Candidate')
verbose_name_plural = _('Candidates')
@ -356,5 +376,24 @@ class Source(models.Model):
verbose_name_plural = _('Sources')
class HiringAgency(models.Model):
name = models.CharField(max_length=200, unique=True, verbose_name=_('Agency Name'))
contact_person = models.CharField(max_length=150, blank=True, verbose_name=_('Contact Person'))
email = models.EmailField(blank=True)
phone = models.CharField(max_length=20, blank=True)
website = models.URLField(blank=True)
notes = models.TextField(blank=True, help_text=_("Internal notes about the agency"))
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.name
class Meta:
verbose_name = _('Hiring Agency')
verbose_name_plural = _('Hiring Agencies')
ordering = ['name']