Commit f54414e0 by Simon Chen

ECOM-5277 create the credit_redemption_overview programs field

parent a62a16cc
......@@ -329,7 +329,8 @@ class ProgramSerializer(serializers.ModelSerializer):
class Meta:
model = Program
fields = ('uuid', 'title', 'subtitle', 'type', 'marketing_slug', 'marketing_url', 'card_image_url',
'banner_image', 'banner_image_url', 'authoring_organizations', 'courses',)
'banner_image', 'banner_image_url', 'authoring_organizations', 'credit_redemption_overview',
'courses',)
read_only_fields = ('uuid', 'marketing_url', 'banner_image')
......
......@@ -282,6 +282,7 @@ class ProgramSerializerTests(TestCase):
'banner_image_url': program.banner_image_url,
'banner_image': expected_banner_image_urls,
'authoring_organizations': OrganizationSerializer(program.authoring_organizations, many=True).data,
'credit_redemption_overview': program.credit_redemption_overview,
'courses': ProgramCourseSerializer(
program.courses,
many=True,
......@@ -322,6 +323,7 @@ class ProgramSerializerTests(TestCase):
'banner_image': {},
'banner_image_url': program.banner_image_url,
'authoring_organizations': OrganizationSerializer(program.authoring_organizations, many=True).data,
'credit_redemption_overview': program.credit_redemption_overview,
'courses': ProgramCourseSerializer(
program.courses,
many=True,
......
......@@ -270,7 +270,8 @@ class XSeriesMarketingSiteDataLoader(AbstractMarketingSiteDataLoader):
'subtitle': data.get('field_xseries_subtitle_short'),
'card_image_url': card_image_url,
'overview': overview,
'video': self.get_or_create_video(video_url)
'video': self.get_or_create_video(video_url),
'credit_redemption_overview': data.get('field_cards_section_description')
}
for field, value in data.items():
......
......@@ -694,6 +694,11 @@ MARKETING_SITE_API_XSERIES_BODIES = [
},
'uuid': '84e07f7f-0f42-44b3-b9f6-d24cde1d7618'
},
'field_cards_section_description': 'The courses in this series have been designed to be taken in order.'
' The first six courses must be completed before enrolling in the capstone.'
'\r\n\r\nIf you are planning to complete both the UX Research and UX Design '
'XSeries, you can start with either one! When you have completed one, you '
'can take the remaining courses in the second series.',
'field_xseries_overview': {
'value': '<h3>What You\'ll Learn</h3> <ul><li>An understanding of the global water cycle and its '
'various processes</li> <li>The mechanisms of climate change and their effects on water '
......@@ -776,6 +781,7 @@ MARKETING_SITE_API_XSERIES_BODIES = [
},
'uuid': 'a8fbba26-4fe0-4dc2-9619-448730ff171c'
},
'field_cards_section_description': None,
'field_xseries_overview': {
'value': '<h3>What You\'ll Learn</h3> <ul><li>How to make trade-offs between cost and service for '
'both the design and operation of supply chains using total cost equations</li> '
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import stdimage.models
import course_discovery.apps.course_metadata.utils
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0019_program_banner_image'),
]
operations = [
migrations.AddField(
model_name='program',
name='credit_redemption_overview',
field=models.TextField(null=True, help_text='The description of credit redemption for courses in program', blank=True),
),
migrations.AlterField(
model_name='program',
name='banner_image',
field=stdimage.models.StdImageField(null=True, blank=True, upload_to=course_discovery.apps.course_metadata.utils.UploadToFieldNamePath('uuid', path='media/programs/banner_images')),
),
migrations.AlterField(
model_name='program',
name='courses',
field=models.ManyToManyField(related_name='programs', to='course_metadata.Course'),
),
]
......@@ -612,6 +612,10 @@ class Program(TimeStampedModel):
corporate_endorsements = SortedManyToManyField(CorporateEndorsement, blank=True)
job_outlook_items = SortedManyToManyField(JobOutlookItem, blank=True)
individual_endorsements = SortedManyToManyField(Endorsement, blank=True)
credit_redemption_overview = models.TextField(
help_text=_('The description of credit redemption for courses in program'),
blank=True, null=True
)
def __str__(self):
return self.title
......
......@@ -182,6 +182,7 @@ class ProgramFactory(factory.django.DjangoModelFactory):
banner_image_url = FuzzyText(prefix='https://example.com/program/banner')
card_image_url = FuzzyText(prefix='https://example.com/program/card')
partner = factory.SubFactory(PartnerFactory)
credit_redemption_overview = FuzzyText()
@factory.post_generation
def courses(self, create, extracted, **kwargs):
......
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