Commit 22bef6f9 by David Ormsbee

Merge pull request #25 from edx/ormsbee/admin_upgrade

Make the admin more usable.
parents 8735e39e 42b66160
......@@ -5,8 +5,31 @@ Admin file for django app edxval.
from django.contrib import admin
from .models import Video, Profile, EncodedVideo, Subtitle, CourseVideo
admin.site.register(Video)
admin.site.register(Profile)
admin.site.register(EncodedVideo)
class ProfileAdmin(admin.ModelAdmin):
list_display = ('id', 'profile_name', 'extension', 'width', 'height')
list_display_links = ('id', 'profile_name')
admin_order_field = 'profile_name'
class EncodedVideoInline(admin.TabularInline):
model = EncodedVideo
class CourseVideoInline(admin.TabularInline):
model = CourseVideo
extra = 0
verbose_name = "Course"
verbose_name_plural = "Courses"
class VideoAdmin(admin.ModelAdmin):
list_display = (
'id', 'edx_video_id', 'client_video_id', 'duration'
)
list_display_links = ('id', 'edx_video_id')
search_fields = ('id', 'edx_video_id', 'client_video_id')
list_per_page = 50
admin_order_field = 'edx_video_id'
inlines = [CourseVideoInline, EncodedVideoInline]
admin.site.register(Profile, ProfileAdmin)
admin.site.register(Video, VideoAdmin)
admin.site.register(Subtitle)
admin.site.register(CourseVideo)
......@@ -57,6 +57,8 @@ class Profile(models.Model):
width = models.PositiveIntegerField()
height = models.PositiveIntegerField()
def __unicode__(self):
return self.profile_name
class Video(models.Model):
"""
......@@ -102,8 +104,8 @@ class CourseVideo(models.Model):
"""
unique_together = ("course_id", "video")
def __str__(self):
return '%s for %s' % (self.video, self.course_id)
def __unicode__(self):
return self.course_id
class EncodedVideo(models.Model):
......
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