|
|
@ -2,7 +2,13 @@ from rest_framework import serializers |
|
|
# from dj_filer.admin import get_thumbs |
|
|
# from dj_filer.admin import get_thumbs |
|
|
from utils import get_thumbs |
|
|
from utils import get_thumbs |
|
|
from apps.course.models import Course, CourseCategory, Attachment, Glossary, LessonCompletion, Participant, Lesson, CourseAttachment, CourseGlossary, CourseLesson |
|
|
from apps.course.models import Course, CourseCategory, Attachment, Glossary, LessonCompletion, Participant, Lesson, CourseAttachment, CourseGlossary, CourseLesson |
|
|
from apps.course.models.course import get_localized_field, normalize_level, normalize_status |
|
|
|
|
|
|
|
|
from apps.course.models.course import ( |
|
|
|
|
|
get_localized_field, |
|
|
|
|
|
get_weekday_label, |
|
|
|
|
|
normalize_level, |
|
|
|
|
|
normalize_status, |
|
|
|
|
|
normalize_weekday_to_key, |
|
|
|
|
|
) |
|
|
from apps.chat.models import RoomMessage |
|
|
from apps.chat.models import RoomMessage |
|
|
from apps.account.serializers import UserProfileSerializer |
|
|
from apps.account.serializers import UserProfileSerializer |
|
|
from decimal import Decimal |
|
|
from decimal import Decimal |
|
|
@ -513,7 +519,16 @@ class CourseDetailSerializer(serializers.ModelSerializer): |
|
|
return [] |
|
|
return [] |
|
|
|
|
|
|
|
|
def get_timing(self, obj): |
|
|
def get_timing(self, obj): |
|
|
return self._extract_builder_list(obj.timing) |
|
|
|
|
|
|
|
|
localized_rows = [] |
|
|
|
|
|
for item in self._extract_builder_list(obj.timing): |
|
|
|
|
|
if not isinstance(item, dict): |
|
|
|
|
|
continue |
|
|
|
|
|
day_key = normalize_weekday_to_key(item.get('day')) |
|
|
|
|
|
localized_rows.append({ |
|
|
|
|
|
"day": get_weekday_label(day_key, self._lang()), |
|
|
|
|
|
"time": item.get('time') or item.get('timing') or "", |
|
|
|
|
|
}) |
|
|
|
|
|
return localized_rows |
|
|
|
|
|
|
|
|
def get_features(self, obj): |
|
|
def get_features(self, obj): |
|
|
return self._extract_builder_list(obj.features) |
|
|
return self._extract_builder_list(obj.features) |
|
|
|