Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix the language issue in course run API. #87

Open
wants to merge 1 commit into
base: develop-koa
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions course_discovery/apps/course_metadata/data_loaders/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ProgramType, Seat, SeatType, Subject, SubjectTranslation, Video
)
from course_discovery.apps.course_metadata.utils import push_to_ecommerce_for_course_run, subtract_deadline_delta
from course_discovery.apps.ietf_language_tags.models import LanguageTag

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -272,6 +273,11 @@ def format_course_run_data(self, body, course=None):
'mobile_available': body.get('mobile_available') or False,
})

if body.get('language') and body.get('language') != 'null':
defaults.update({
'language': LanguageTag.objects.filter(code=body.get('language')).first()
})

if course:
defaults['course'] = course

Expand Down