diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 706b3fea..c48e527d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,10 @@ Change Log Unreleased +[1.45.0] - 2023-10-13 +--------------------- +* feat: Added the ability to blacklist job-skill relationship. + [1.44.3] - 2023-09-20 --------------------- * perf: improve xblock skills api performance. diff --git a/taxonomy/__init__.py b/taxonomy/__init__.py index 9b3bae06..6709612d 100644 --- a/taxonomy/__init__.py +++ b/taxonomy/__init__.py @@ -15,6 +15,6 @@ # 2. MINOR version when you add functionality in a backwards compatible manner, and # 3. PATCH version when you make backwards compatible bug fixes. # More details can be found at https://semver.org/ -__version__ = '1.44.3' +__version__ = '1.45.0' default_app_config = 'taxonomy.apps.TaxonomyConfig' # pylint: disable=invalid-name diff --git a/taxonomy/admin.py b/taxonomy/admin.py index 9143ea45..0080bda6 100644 --- a/taxonomy/admin.py +++ b/taxonomy/admin.py @@ -111,8 +111,9 @@ class JobSkillsAdmin(admin.ModelAdmin): Administrative view for Job Skills. """ - list_display = ('id', 'skill', 'job', 'significance', 'unique_postings', 'created', 'modified') + list_display = ('id', 'is_blacklisted', 'skill', 'job', 'significance', 'unique_postings', 'created', 'modified') search_fields = ('name', 'significance',) + list_filter = ('is_blacklisted', ) @admin.register(IndustryJobSkill) @@ -121,7 +122,10 @@ class IndustryJobSkillAdmin(admin.ModelAdmin): Administrative view for Industry Job Skills. """ - list_display = ('id', 'industry', 'skill', 'job', 'significance', 'unique_postings', 'created', 'modified') + list_display = ( + 'id', 'is_blacklisted', 'industry', 'skill', 'job', 'significance', 'unique_postings', 'created', 'modified', + ) + list_filter = ('is_blacklisted', ) @admin.register(JobPostings) diff --git a/taxonomy/migrations/0035_auto_20231013_0324.py b/taxonomy/migrations/0035_auto_20231013_0324.py new file mode 100644 index 00000000..bf616920 --- /dev/null +++ b/taxonomy/migrations/0035_auto_20231013_0324.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.20 on 2023-10-13 03:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('taxonomy', '0034_alter_xblockskills_usage_key'), + ] + + operations = [ + migrations.AddField( + model_name='industryjobskill', + name='is_blacklisted', + field=models.BooleanField(default=False, help_text='Should this job skill be ignored?'), + ), + migrations.AddField( + model_name='jobskills', + name='is_blacklisted', + field=models.BooleanField(default=False, help_text='Should this job skill be ignored?'), + ), + ] diff --git a/taxonomy/models.py b/taxonomy/models.py index 5f0400b3..61a5b9e2 100644 --- a/taxonomy/models.py +++ b/taxonomy/models.py @@ -632,6 +632,7 @@ class BaseJobSkill(TimeStampedModel): 'The unique_postings threshold of skill for the job.' ) ) + is_blacklisted = models.BooleanField(default=False, help_text=_('Should this job skill be ignored?')) class Meta: """ @@ -640,6 +641,24 @@ class Meta: abstract = True + @classmethod + def get_whitelisted_job_skills(cls): + """ + Get a QuerySet of whitelisted job skills. + + White listed job skills are job skills with `is_blacklisted=False`. + """ + return cls.objects.filter(is_blacklisted=False) + + @classmethod + def get_blacklist_job_skill(cls): + """ + Get a QuerySet of whitelisted job skills. + + White listed job skills are job skills with `is_blacklisted=False`. + """ + return cls.objects.filter(is_blacklisted=True) + class JobSkills(BaseJobSkill): """