-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: skill validation configuration to disable validation for xblock…
… skills
- Loading branch information
1 parent
036041f
commit bce3283
Showing
7 changed files
with
259 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
..._discovery/apps/taxonomy_support/migrations/0004_skillvalidationconfiguration_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Generated by Django 4.2.9 on 2024-03-21 07:24 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
import model_utils.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('course_metadata', '0340_auto_20231211_1032'), | ||
('taxonomy_support', '0003_updatecourserecommendationsconfig_num_past_days'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='SkillValidationConfiguration', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), | ||
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), | ||
('course', models.ForeignKey(blank=True, help_text='The course, for which skill validation is disabled.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='course_metadata.course')), | ||
('organization', models.ForeignKey(blank=True, help_text='The organization, for which skill validation is disabled.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='course_metadata.organization')), | ||
], | ||
options={ | ||
'verbose_name': 'Skill Validation Configuration', | ||
'verbose_name_plural': 'Skill Validation Configurations', | ||
}, | ||
), | ||
migrations.AddConstraint( | ||
model_name='skillvalidationconfiguration', | ||
constraint=models.CheckConstraint(check=models.Q(models.Q(('course__isnull', False), ('organization__isnull', True)), models.Q(('course__isnull', True), ('organization__isnull', False)), _connector='OR'), name='either_course_or_org', violation_error_message='Select either course or organization.'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='skillvalidationconfiguration', | ||
constraint=models.UniqueConstraint(fields=('course',), name='unique_course'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='skillvalidationconfiguration', | ||
constraint=models.UniqueConstraint(fields=('organization',), name='unique_organization'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Model factory classes for testing. | ||
""" | ||
|
||
import factory | ||
|
||
from course_discovery.apps.taxonomy_support.models import SkillValidationConfiguration | ||
|
||
|
||
class SkillValidationConfigurationFactory(factory.django.DjangoModelFactory): | ||
|
||
class Meta: | ||
model = SkillValidationConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters