Commit 180cf299 by Hasnain

Added instructor info in course overview.

parent 576f6755
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('course_overviews', '0010_auto_20160329_2317'),
]
operations = [
migrations.AddField(
model_name='courseoverview',
name='instructor_info',
field=jsonfield.fields.JSONField(default={}),
),
]
......@@ -12,6 +12,7 @@ from django.template import defaultfilters
from ccx_keys.locator import CCXLocator
from model_utils.models import TimeStampedModel
from jsonfield.fields import JSONField
from opaque_keys.edx.keys import CourseKey
from config_models.models import ConfigurationModel
......@@ -43,7 +44,7 @@ class CourseOverview(TimeStampedModel):
app_label = 'course_overviews'
# IMPORTANT: Bump this whenever you modify this model and/or add a migration.
VERSION = 4
VERSION = 5
# Cache entry versioning.
version = IntegerField()
......@@ -97,6 +98,7 @@ class CourseOverview(TimeStampedModel):
course_video_url = TextField(null=True)
effort = TextField(null=True)
self_paced = BooleanField(default=False)
instructor_info = JSONField(null=False, blank=False, default={})
@classmethod
def _create_from_course(cls, course):
......@@ -181,6 +183,7 @@ class CourseOverview(TimeStampedModel):
effort=CourseDetails.fetch_about_attribute(course.id, 'effort'),
course_video_url=CourseDetails.fetch_video_url(course.id),
self_paced=course.self_paced,
instructor_info=course.instructor_info,
)
@classmethod
......
......@@ -113,6 +113,7 @@ class CourseOverviewTestCase(ModuleStoreTestCase):
'invitation_only',
'max_student_enrollments_allowed',
'catalog_visibility',
'instructor_info'
]
for attribute_name in fields_to_test:
course_value = getattr(course, attribute_name)
......@@ -203,6 +204,24 @@ class CourseOverviewTestCase(ModuleStoreTestCase):
],
"static_asset_path": "/my/abs/path", # Absolute path
"certificates_show_before_end": True,
"instructor_info": { # Instructor info provided
"instructors": [
{
"bio": "TestInstructor1 Bio.",
"image": "/fake-image-path/image1.jpeg",
"organization": "TestX",
"name": "TestInstructor1",
"title": "Test Title1"
},
{
"bio": "TestInstructor2 Bio.",
"image": "/fake-image-path/image2.jpeg",
"organization": "TestX",
"name": "TestInstructor2",
"title": "Test Title2"
}
]
}
},
{
"display_name": "", # Empty display name
......@@ -213,6 +232,7 @@ class CourseOverviewTestCase(ModuleStoreTestCase):
"static_asset_path": "my/relative/path", # Relative asset path
"certificates_show_before_end": False,
"catalog_visibility": CATALOG_VISIBILITY_CATALOG_AND_ABOUT,
"instructor_info": {}, # Empty Instructor info
},
{
"display_name": "", # Empty display name
......@@ -223,6 +243,7 @@ class CourseOverviewTestCase(ModuleStoreTestCase):
"static_asset_path": "", # Empty asset path
"certificates_show_before_end": False,
"catalog_visibility": CATALOG_VISIBILITY_ABOUT,
"instructor_info": None,
},
{
# # Don't set display name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment