예제 #1
0
    def to_internal_value(self, data):
        """
        Convert data into CourseVideo instance and image filename tuple.
        """
        course_id = data
        course_video = image = ''
        if data:
            if isinstance(data, dict):
                (course_id, image), = data.items()

            course_video = CourseVideo(course_id=course_id)
            course_video.full_clean(exclude=['video'])

        return course_video, image
예제 #2
0
 def to_internal_value(self, data):
     if data:
         course_video = CourseVideo(course_id=data)
         course_video.full_clean(exclude=["video"])
         return course_video