Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-val
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-val
Commits
c2b29bee
Commit
c2b29bee
authored
Oct 16, 2017
by
Muzaffar yousaf
Committed by
GitHub
Oct 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #104 from edx/opt-val-admin
VAL admin optimizations
parents
0a9c8239
ad8e4f31
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
3 deletions
+36
-3
edxval/admin.py
+36
-3
No files found.
edxval/admin.py
View file @
c2b29bee
"""
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment