Skip to content

Commit

Permalink
Merge pull request #184 from openedx/saleem-latif/ENT-7620
Browse files Browse the repository at this point in the history
ENT-7620: Added the ability to blacklist job-skill relationship.
  • Loading branch information
saleem-latif authored Oct 17, 2023
2 parents 280ea96 + 54eeb26 commit 233f8ab
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion taxonomy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions taxonomy/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
23 changes: 23 additions & 0 deletions taxonomy/migrations/0035_auto_20231013_0324.py
Original file line number Diff line number Diff line change
@@ -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?'),
),
]
19 changes: 19 additions & 0 deletions taxonomy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand All @@ -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):
"""
Expand Down

0 comments on commit 233f8ab

Please sign in to comment.