From ac76eda862b4af46fd2e14b192791ed4f480a65d Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Fri, 18 Oct 2019 13:59:08 -0400 Subject: [PATCH 1/7] Open the image file as binary. --- .../certificates/migrations/0003_data__default_modes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/certificates/migrations/0003_data__default_modes.py b/lms/djangoapps/certificates/migrations/0003_data__default_modes.py index 700ba92b23..5cadd3c806 100644 --- a/lms/djangoapps/certificates/migrations/0003_data__default_modes.py +++ b/lms/djangoapps/certificates/migrations/0003_data__default_modes.py @@ -22,7 +22,7 @@ def forwards(apps, schema_editor): file_name = '{0}{1}'.format(mode, '.png') conf.icon.save( 'badges/{}'.format(file_name), - File(open(settings.PROJECT_ROOT / 'static' / 'images' / 'default-badges' / file_name)) + File(open(settings.PROJECT_ROOT / 'static' / 'images' / 'default-badges' / file_name, 'rb')) ) conf.save() From 3d51bc7be3ed2b6836e37f6bbb57a72b857c34ab Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 21 Oct 2019 10:53:59 -0400 Subject: [PATCH 2/7] Fix type mismatches in the bookmarks migration. Mixing byte and unicode strings causes migrations to fail. --- .../core/djangoapps/bookmarks/migrations/0001_initial.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py b/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py index 3b2cddb6e9..10499d71c3 100644 --- a/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py +++ b/openedx/core/djangoapps/bookmarks/migrations/0001_initial.py @@ -25,7 +25,7 @@ class Migration(migrations.Migration): ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('course_key', CourseKeyField(max_length=255, db_index=True)), ('usage_key', UsageKeyField(max_length=255, db_index=True)), - ('_path', jsonfield.fields.JSONField(help_text=b'Path in course tree to the block', db_column=b'path')), + ('_path', jsonfield.fields.JSONField(help_text='Path in course tree to the block', db_column='path')), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), @@ -37,8 +37,8 @@ class Migration(migrations.Migration): ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('course_key', CourseKeyField(max_length=255, db_index=True)), ('usage_key', UsageKeyField(unique=True, max_length=255, db_index=True)), - ('display_name', models.CharField(default=b'', max_length=255)), - ('_paths', jsonfield.fields.JSONField(default=[], help_text=b'All paths in course tree to the corresponding block.', db_column=b'paths')), + ('display_name', models.CharField(default='', max_length=255)), + ('_paths', jsonfield.fields.JSONField(default=[], help_text='All paths in course tree to the corresponding block.', db_column='paths')), ], options={ 'abstract': False, From 6584f8119877529bfde1a2821821f33d6536b544 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 21 Oct 2019 10:54:31 -0400 Subject: [PATCH 3/7] Fix type mismatches in the course_groups migration. Mixing byte and unicode strings causes migrations to fail. --- .../course_groups/migrations/0001_initial.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openedx/core/djangoapps/course_groups/migrations/0001_initial.py b/openedx/core/djangoapps/course_groups/migrations/0001_initial.py index 3bcf87d373..f8b634a13d 100644 --- a/openedx/core/djangoapps/course_groups/migrations/0001_initial.py +++ b/openedx/core/djangoapps/course_groups/migrations/0001_initial.py @@ -24,7 +24,7 @@ class Migration(migrations.Migration): name='CourseCohort', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('assignment_type', models.CharField(default=b'manual', max_length=20, choices=[(b'random', b'Random'), (b'manual', b'Manual')])), + ('assignment_type', models.CharField(default='manual', max_length=20, choices=[('random', 'Random'), ('manual', 'Manual')])), ], ), migrations.CreateModel( @@ -32,8 +32,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('is_cohorted', models.BooleanField(default=False)), - ('course_id', CourseKeyField(help_text=b'Which course are these settings associated with?', unique=True, max_length=255, db_index=True)), - ('_cohorted_discussions', models.TextField(null=True, db_column=b'cohorted_discussions', blank=True)), + ('course_id', CourseKeyField(help_text='Which course are these settings associated with?', unique=True, max_length=255, db_index=True)), + ('_cohorted_discussions', models.TextField(null=True, db_column='cohorted_discussions', blank=True)), ('always_cohort_inline_discussions', models.BooleanField(default=True)), ], ), @@ -41,18 +41,18 @@ class Migration(migrations.Migration): name='CourseUserGroup', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('name', models.CharField(help_text=b'What is the name of this group? Must be unique within a course.', max_length=255)), - ('course_id', CourseKeyField(help_text=b'Which course is this group associated with?', max_length=255, db_index=True)), - ('group_type', models.CharField(max_length=20, choices=[(b'cohort', b'Cohort')])), - ('users', models.ManyToManyField(help_text=b'Who is in this group?', related_name='course_groups', to=settings.AUTH_USER_MODEL, db_index=True)), + ('name', models.CharField(help_text='What is the name of this group? Must be unique within a course.', max_length=255)), + ('course_id', CourseKeyField(help_text='Which course is this group associated with?', max_length=255, db_index=True)), + ('group_type', models.CharField(max_length=20, choices=[('cohort', 'Cohort')])), + ('users', models.ManyToManyField(help_text='Who is in this group?', related_name='course_groups', to=settings.AUTH_USER_MODEL, db_index=True)), ], ), migrations.CreateModel( name='CourseUserGroupPartitionGroup', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('partition_id', models.IntegerField(help_text=b'contains the id of a cohorted partition in this course')), - ('group_id', models.IntegerField(help_text=b'contains the id of a specific group within the cohorted partition')), + ('partition_id', models.IntegerField(help_text='contains the id of a cohorted partition in this course')), + ('group_id', models.IntegerField(help_text='contains the id of a specific group within the cohorted partition')), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('course_user_group', models.OneToOneField(to='course_groups.CourseUserGroup', on_delete=models.CASCADE)), From 798dde21565142a4ed832f253712ac7a7f3cd580 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 21 Oct 2019 10:56:50 -0400 Subject: [PATCH 4/7] Fix type mismatches in the course_modes migrations. Mixing byte and unicode strings causes migrations to fail. --- .../migrations/0012_historicalcoursemode.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/djangoapps/course_modes/migrations/0012_historicalcoursemode.py b/common/djangoapps/course_modes/migrations/0012_historicalcoursemode.py index 4858139569..d3d61a1ace 100644 --- a/common/djangoapps/course_modes/migrations/0012_historicalcoursemode.py +++ b/common/djangoapps/course_modes/migrations/0012_historicalcoursemode.py @@ -26,14 +26,14 @@ class Migration(migrations.Migration): ('mode_slug', models.CharField(max_length=100, verbose_name='Mode')), ('mode_display_name', models.CharField(max_length=255, verbose_name='Display Name')), ('min_price', models.IntegerField(default=0, verbose_name='Price')), - ('currency', models.CharField(default=b'usd', max_length=8)), - ('_expiration_datetime', models.DateTimeField(blank=True, db_column=b'expiration_datetime', default=None, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline')), + ('currency', models.CharField(default='usd', max_length=8)), + ('_expiration_datetime', models.DateTimeField(blank=True, db_column='expiration_datetime', default=None, help_text='OPTIONAL: After this date/time, users will no longer be able to enroll in this mode. Leave this blank if users can enroll in this mode until enrollment closes for the course.', null=True, verbose_name='Upgrade Deadline')), ('expiration_datetime_is_explicit', models.BooleanField(default=False)), ('expiration_date', models.DateField(blank=True, default=None, null=True)), - ('suggested_prices', models.CharField(blank=True, default=b'', max_length=255, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')])), + ('suggested_prices', models.CharField(blank=True, default='', max_length=255, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z'), code='invalid', message='Enter only digits separated by commas.')])), ('description', models.TextField(blank=True, null=True)), - ('sku', models.CharField(blank=True, help_text='OPTIONAL: This is the SKU (stock keeping unit) of this mode in the external ecommerce service. Leave this blank if the course has not yet been migrated to the ecommerce service.', max_length=255, null=True, verbose_name=b'SKU')), - ('bulk_sku', models.CharField(blank=True, default=None, help_text='This is the bulk SKU (stock keeping unit) of this mode in the external ecommerce service.', max_length=255, null=True, verbose_name=b'Bulk SKU')), + ('sku', models.CharField(blank=True, help_text='OPTIONAL: This is the SKU (stock keeping unit) of this mode in the external ecommerce service. Leave this blank if the course has not yet been migrated to the ecommerce service.', max_length=255, null=True, verbose_name='SKU')), + ('bulk_sku', models.CharField(blank=True, default=None, help_text='This is the bulk SKU (stock keeping unit) of this mode in the external ecommerce service.', max_length=255, null=True, verbose_name='Bulk SKU')), ('history_id', models.AutoField(primary_key=True, serialize=False)), ('history_date', models.DateTimeField()), ('history_change_reason', models.CharField(max_length=100, null=True)), From 215dc84469941be22f228d394d88d6928c11aed1 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 21 Oct 2019 11:01:37 -0400 Subject: [PATCH 5/7] Fix type mismatches in the courseware migrations. Mixing byte and unicode strings causes migrations to fail. --- .../courseware/migrations/0001_initial.py | 14 +++++++------- .../migrations/0006_remove_module_id_index.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lms/djangoapps/courseware/migrations/0001_initial.py b/lms/djangoapps/courseware/migrations/0001_initial.py index 6bc122ddab..4e3c29feef 100644 --- a/lms/djangoapps/courseware/migrations/0001_initial.py +++ b/lms/djangoapps/courseware/migrations/0001_initial.py @@ -49,7 +49,7 @@ class Migration(migrations.Migration): ('course_id', CourseKeyField(max_length=255, db_index=True)), ('location', UsageKeyField(max_length=255, db_index=True)), ('field', models.CharField(max_length=255)), - ('value', models.TextField(default=b'null')), + ('value', models.TextField(default='null')), ('student', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), @@ -57,13 +57,13 @@ class Migration(migrations.Migration): name='StudentModule', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('module_type', models.CharField(default=b'problem', max_length=32, db_index=True, choices=[(b'problem', b'problem'), (b'video', b'video'), (b'html', b'html'), (b'course', b'course'), (b'chapter', b'Section'), (b'sequential', b'Subsection'), (b'library_content', b'Library Content')])), - ('module_state_key', UsageKeyField(max_length=255, db_column=b'module_id', db_index=True)), + ('module_type', models.CharField(default='problem', max_length=32, db_index=True, choices=[('problem', 'problem'), ('video', 'video'), ('html', 'html'), ('course', 'course'), ('chapter', 'Section'), ('sequential', 'Subsection'), ('library_content', 'Library Content')])), + ('module_state_key', UsageKeyField(max_length=255, db_column='module_id', db_index=True)), ('course_id', CourseKeyField(max_length=255, db_index=True)), ('state', models.TextField(null=True, blank=True)), ('grade', models.FloatField(db_index=True, null=True, blank=True)), ('max_grade', models.FloatField(null=True, blank=True)), - ('done', models.CharField(default=b'na', max_length=8, db_index=True, choices=[(b'na', b'NOT_APPLICABLE'), (b'f', b'FINISHED'), (b'i', b'INCOMPLETE')])), + ('done', models.CharField(default='na', max_length=8, db_index=True, choices=[('na', 'NOT_APPLICABLE'), ('f', 'FINISHED'), ('i', 'INCOMPLETE')])), ('created', models.DateTimeField(auto_now_add=True, db_index=True)), ('modified', models.DateTimeField(auto_now=True, db_index=True)), ('student', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), @@ -89,7 +89,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('field_name', models.CharField(max_length=64, db_index=True)), - ('value', models.TextField(default=b'null')), + ('value', models.TextField(default='null')), ('created', models.DateTimeField(auto_now_add=True, db_index=True)), ('modified', models.DateTimeField(auto_now=True, db_index=True)), ('student', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), @@ -100,7 +100,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('field_name', models.CharField(max_length=64, db_index=True)), - ('value', models.TextField(default=b'null')), + ('value', models.TextField(default='null')), ('created', models.DateTimeField(auto_now_add=True, db_index=True)), ('modified', models.DateTimeField(auto_now=True, db_index=True)), ('module_type', BlockTypeKeyField(max_length=64, db_index=True)), @@ -112,7 +112,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('field_name', models.CharField(max_length=64, db_index=True)), - ('value', models.TextField(default=b'null')), + ('value', models.TextField(default='null')), ('created', models.DateTimeField(auto_now_add=True, db_index=True)), ('modified', models.DateTimeField(auto_now=True, db_index=True)), ('usage_id', UsageKeyField(max_length=255, db_index=True)), diff --git a/lms/djangoapps/courseware/migrations/0006_remove_module_id_index.py b/lms/djangoapps/courseware/migrations/0006_remove_module_id_index.py index d1f33026cd..d78869e9f8 100644 --- a/lms/djangoapps/courseware/migrations/0006_remove_module_id_index.py +++ b/lms/djangoapps/courseware/migrations/0006_remove_module_id_index.py @@ -16,6 +16,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='studentmodule', name='module_state_key', - field=opaque_keys.edx.django.models.UsageKeyField(db_column=b'module_id', max_length=255), + field=opaque_keys.edx.django.models.UsageKeyField(db_column='module_id', max_length=255), ), ] From 13a73fd7762e0e176fc8d6d51016cfbd982f05bf Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 21 Oct 2019 11:40:54 -0400 Subject: [PATCH 6/7] Fix type mismatches in the django_comment_common migrations. Mixing byte and unicode strings causes migrations to fail. --- .../migrations/0005_coursediscussionsettings.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/django_comment_common/migrations/0005_coursediscussionsettings.py b/openedx/core/djangoapps/django_comment_common/migrations/0005_coursediscussionsettings.py index 5c627a8848..de82766a06 100644 --- a/openedx/core/djangoapps/django_comment_common/migrations/0005_coursediscussionsettings.py +++ b/openedx/core/djangoapps/django_comment_common/migrations/0005_coursediscussionsettings.py @@ -16,10 +16,10 @@ class Migration(migrations.Migration): name='CourseDiscussionSettings', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('course_id', CourseKeyField(help_text=b'Which course are these settings associated with?', unique=True, max_length=255, db_index=True)), + ('course_id', CourseKeyField(help_text='Which course are these settings associated with?', unique=True, max_length=255, db_index=True)), ('always_divide_inline_discussions', models.BooleanField(default=False)), - ('_divided_discussions', models.TextField(null=True, db_column=b'divided_discussions', blank=True)), - ('division_scheme', models.CharField(default=b'none', max_length=20, choices=[(b'none', b'None'), (b'cohort', b'Cohort'), (b'enrollment_track', b'Enrollment Track')])), + ('_divided_discussions', models.TextField(null=True, db_column='divided_discussions', blank=True)), + ('division_scheme', models.CharField(default='none', max_length=20, choices=[('none', 'None'), ('cohort', 'Cohort'), ('enrollment_track', 'Enrollment Track')])), ], options={ 'db_table': 'django_comment_common_coursediscussionsettings', From 871d62f246aabb677dfed274a5489c449ab8a0f4 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 21 Oct 2019 13:32:46 -0400 Subject: [PATCH 7/7] Fix type mismatches in the grades migrations. Mixing byte and unicode strings causes migrations to fail. --- lms/djangoapps/grades/migrations/0001_initial.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/grades/migrations/0001_initial.py b/lms/djangoapps/grades/migrations/0001_initial.py index 6ad43b0df7..02d42f52e1 100644 --- a/lms/djangoapps/grades/migrations/0001_initial.py +++ b/lms/djangoapps/grades/migrations/0001_initial.py @@ -24,8 +24,8 @@ class Migration(migrations.Migration): ('user_id', models.IntegerField()), ('course_id', CourseKeyField(max_length=255)), ('usage_key', UsageKeyField(max_length=255)), - ('subtree_edited_date', models.DateTimeField(verbose_name=b'last content edit timestamp')), - ('course_version', models.CharField(max_length=255, verbose_name=b'guid of latest course version', blank=True)), + ('subtree_edited_date', models.DateTimeField(verbose_name='last content edit timestamp')), + ('course_version', models.CharField(max_length=255, verbose_name='guid of latest course version', blank=True)), ('earned_all', models.FloatField()), ('possible_all', models.FloatField()), ('earned_graded', models.FloatField()), @@ -43,7 +43,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='persistentsubsectiongrade', name='visible_blocks', - field=models.ForeignKey(to='grades.VisibleBlocks', db_column=b'visible_blocks_hash', to_field=b'hashed', on_delete=models.CASCADE), + field=models.ForeignKey(to='grades.VisibleBlocks', db_column='visible_blocks_hash', to_field='hashed', on_delete=models.CASCADE), ), migrations.AlterUniqueTogether( name='persistentsubsectiongrade',