Merge pull request #19990 from cpennington/fix-org-course-docs
Update the documentation and validation on org_course to make the for…
This commit is contained in:
@@ -37,6 +37,14 @@ class Provenance(Enum):
|
||||
default = 'Default'
|
||||
|
||||
|
||||
def validate_course_in_org(value):
|
||||
if value.count('+') != 1:
|
||||
raise ValidationError(
|
||||
_('%(value)s should have the form ORG+COURSE'),
|
||||
params={'value': value},
|
||||
)
|
||||
|
||||
|
||||
class StackedConfigurationModel(ConfigurationModel):
|
||||
"""
|
||||
A ConfigurationModel that stacks Global, Site, Org, Course, and Course Run level
|
||||
@@ -82,8 +90,9 @@ class StackedConfigurationModel(ConfigurationModel):
|
||||
verbose_name=_("Course in Org"),
|
||||
help_text=_(
|
||||
"Configure values for all course runs associated with this course. "
|
||||
"This is should be formatted as 'org/course' (i.e. MITx/6.002x, HarvardX/CS50)."
|
||||
"This is should be formatted as 'org+course' (i.e. MITx+6.002x, HarvardX+CS50)."
|
||||
),
|
||||
validators=[validate_course_in_org],
|
||||
)
|
||||
course = models.ForeignKey(
|
||||
CourseOverview,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.20 on 2019-03-13 16:34
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import openedx.core.djangoapps.config_model_utils.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('content_type_gating', '0007_auto_20190311_1919'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='contenttypegatingconfig',
|
||||
name='org_course',
|
||||
field=models.CharField(blank=True, db_index=True, help_text="Configure values for all course runs associated with this course. This is should be formatted as 'org+course' (i.e. MITx+6.002x, HarvardX+CS50).", max_length=255, null=True, validators=[openedx.core.djangoapps.config_model_utils.models.validate_course_in_org], verbose_name='Course in Org'),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.20 on 2019-03-13 16:34
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import openedx.core.djangoapps.config_model_utils.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('course_duration_limits', '0007_auto_20190311_1919'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='coursedurationlimitconfig',
|
||||
name='org_course',
|
||||
field=models.CharField(blank=True, db_index=True, help_text="Configure values for all course runs associated with this course. This is should be formatted as 'org+course' (i.e. MITx+6.002x, HarvardX+CS50).", max_length=255, null=True, validators=[openedx.core.djangoapps.config_model_utils.models.validate_course_in_org], verbose_name='Course in Org'),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user