diff --git a/offer_backend/apps/jobs/filters.py b/offer_backend/apps/jobs/filters.py index b14e44f..1a9a164 100644 --- a/offer_backend/apps/jobs/filters.py +++ b/offer_backend/apps/jobs/filters.py @@ -7,7 +7,8 @@ class JobFilter(django_filters.FilterSet): category = django_filters.CharFilter(lookup_expr='exact') location = django_filters.CharFilter(lookup_expr='icontains') organization = django_filters.NumberFilter(field_name='organization__id') + education = django_filters.BaseInFilter(field_name='education', lookup_expr='in') class Meta: model = Job - fields = ['title', 'category', 'location', 'organization'] + fields = ['title', 'category', 'location', 'organization', 'education'] diff --git a/offer_backend/apps/jobs/migrations/0003_job_education.py b/offer_backend/apps/jobs/migrations/0003_job_education.py new file mode 100644 index 0000000..2b9f666 --- /dev/null +++ b/offer_backend/apps/jobs/migrations/0003_job_education.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.20 on 2026-03-27 05:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jobs', '0002_jobfavorite'), + ] + + operations = [ + migrations.AddField( + model_name='job', + name='education', + field=models.CharField(choices=[('博士', '博士'), ('硕士', '硕士'), ('本科及以下', '本科及以下')], default='本科及以下', max_length=20, verbose_name='学历要求'), + ), + ] diff --git a/offer_backend/apps/jobs/models.py b/offer_backend/apps/jobs/models.py index 835ab1a..93387ad 100644 --- a/offer_backend/apps/jobs/models.py +++ b/offer_backend/apps/jobs/models.py @@ -7,6 +7,11 @@ class Job(models.Model): ('published', '已发布'), ('closed', '已关闭'), ] + EDUCATION_CHOICES = [ + ('博士', '博士'), + ('硕士', '硕士'), + ('本科及以下', '本科及以下'), + ] organization = models.ForeignKey( 'organizations.Organization', on_delete=models.CASCADE, @@ -16,6 +21,7 @@ class Job(models.Model): category = models.CharField(max_length=50, verbose_name='职位类别') location = models.CharField(max_length=100, verbose_name='工作地点') salary = models.CharField(max_length=50, verbose_name='薪资范围') + education = models.CharField(max_length=20, choices=EDUCATION_CHOICES, default='本科及以下', verbose_name='学历要求') description = models.TextField(verbose_name='职位描述', blank=True) status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='draft') created_at = models.DateTimeField(auto_now_add=True) diff --git a/offer_backend/apps/jobs/serializers.py b/offer_backend/apps/jobs/serializers.py index a91aedf..cba1775 100644 --- a/offer_backend/apps/jobs/serializers.py +++ b/offer_backend/apps/jobs/serializers.py @@ -9,7 +9,7 @@ class JobListSerializer(serializers.ModelSerializer): class Meta: model = Job - fields = ['id', 'title', 'category', 'location', 'salary', + fields = ['id', 'title', 'category', 'location', 'salary', 'education', 'organization', 'organization_name', 'status', 'created_at'] @@ -24,7 +24,7 @@ class JobDetailSerializer(serializers.ModelSerializer): class Meta: model = Job - fields = ['id', 'title', 'category', 'location', 'salary', + fields = ['id', 'title', 'category', 'location', 'salary', 'education', 'description', 'organization', 'organization_id', 'status', 'created_at'] diff --git a/offer_frontend/src/layouts/PortalLayout.vue b/offer_frontend/src/layouts/PortalLayout.vue index 0b6d038..3d5ea1c 100644 --- a/offer_frontend/src/layouts/PortalLayout.vue +++ b/offer_frontend/src/layouts/PortalLayout.vue @@ -36,7 +36,6 @@ @@ -71,8 +70,8 @@ - -