Fix integrity errors

This commit is contained in:
Qubad786
2018-08-08 18:44:22 +05:00
committed by M. Rehan
parent b26bb7f98e
commit b961569d35
2 changed files with 6 additions and 5 deletions

View File

@@ -144,7 +144,8 @@ class Command(BaseCommand):
)
if commit and options.get('from_settings') and migration_settings.all_courses:
MigrationEnqueuedCourse.objects.bulk_create([
MigrationEnqueuedCourse(course_id=course_key, command_run=command_run)
for course_key in course_keys
])
for course_key in course_keys:
enqueued_course, created = MigrationEnqueuedCourse.objects.get_or_create(course_id=course_key)
if created:
enqueued_course.command_run = command_run
enqueued_course.save()

View File

@@ -194,7 +194,7 @@ def validate_video_image(image_file):
Arguments:
image_file: The selected image file.
Returns:
Returns:
error (String or None): If there is error returns error message otherwise None.
"""
error = None