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
249a6e98
Commit
249a6e98
authored
Mar 30, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add validation step by calling full_clean on newly created objects.
parent
eb53ca0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
edxval/api.py
+7
-2
No files found.
edxval/api.py
View file @
249a6e98
...
...
@@ -436,6 +436,7 @@ def import_from_xml(xml, edx_video_id, course_id):
duration
=
video_el
.
get
(
'duration'
),
status
=
video_el
.
get
(
'status'
),
)
video
.
full_clean
()
encoded_videos_el
=
video_el
.
find
(
'encoded_videos'
)
if
encoded_videos_el
:
...
...
@@ -460,16 +461,20 @@ def import_from_xml(xml, edx_video_id, course_id):
# only add the encoded video if one for its profile doesn't already exist.
if
not
EncodedVideo
.
objects
.
filter
(
profile__profile_name
=
profile
)
.
exists
():
EncodedVideo
.
objects
.
create
(
encoded_video
=
EncodedVideo
.
objects
.
create
(
video
=
video
,
profile
=
profile
,
url
=
encoded_video_el
.
get
(
'url'
),
file_size
=
encoded_video_el
.
get
(
'file_size'
),
bitrate
=
encoded_video_el
.
get
(
'bitrate'
),
)
encoded_video
.
full_clean
()
# Associate the (existing or new) video with the given course_id.
CourseVideo
.
objects
.
get_or_create
(
course_video
,
created
=
CourseVideo
.
objects
.
get_or_create
(
video
=
video
,
course_id
=
course_id
)
if
created
:
course_video
.
full_clean
()
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