Commit c2b29bee by Muzaffar yousaf Committed by GitHub

Merge pull request #104 from edx/opt-val-admin

VAL admin optimizations
parents 0a9c8239 ad8e4f31
"""
Admin file for django app edxval.
"""
from django import forms
from django.contrib import admin
from .models import (CourseVideo, EncodedVideo, Profile, TranscriptPreference,
......@@ -37,20 +37,53 @@ class VideoAdmin(admin.ModelAdmin): # pylint: disable=C0111
class VideoImageAdmin(admin.ModelAdmin):
raw_id_fields = ('course_video', )
list_display = ('get_course_video', 'image', 'generated_images')
def get_course_video(self, obj):
return u'"{course_id}" -- "{edx_video_id}" '.format(
course_id=obj.course_video.course_id,
edx_video_id=obj.course_video.video.edx_video_id
)
get_course_video.admin_order_field = 'course_video'
get_course_video.short_description = 'Course Video'
model = VideoImage
verbose_name = 'Video Image'
verbose_name_plural = 'Video Images'
class CourseVideoAdmin(admin.ModelAdmin):
list_display = ('course_id', 'get_video_id', 'is_hidden')
def get_video_id(self, obj):
return obj.video.edx_video_id
get_video_id.admin_order_field = 'video'
get_video_id.short_description = 'edX Video Id'
model = CourseVideo
verbose_name = 'Course Video'
verbose_name_plural = 'Course Videos'
class VideoTranscriptAdmin(admin.ModelAdmin):
list_display = ('video_id', 'language_code', 'provider', 'file_format')
model = VideoTranscript
class TranscriptPreferenceAdmin(admin.ModelAdmin):
list_display = ('course_id', 'provider', 'video_source_language', 'preferred_languages')
model = TranscriptPreference
admin.site.register(Profile, ProfileAdmin)
admin.site.register(Video, VideoAdmin)
admin.site.register(VideoTranscript)
admin.site.register(TranscriptPreference)
admin.site.register(VideoTranscript, VideoTranscriptAdmin)
admin.site.register(TranscriptPreference, TranscriptPreferenceAdmin)
admin.site.register(VideoImage, VideoImageAdmin)
admin.site.register(CourseVideo, CourseVideoAdmin)
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