From d081b3a86dd626c1de9d07b415b32ada0660da5e Mon Sep 17 00:00:00 2001 From: Ayub khan Date: Tue, 22 Oct 2019 15:05:52 +0500 Subject: [PATCH] BOM-947 certificates: Explicitly Set fields to unicode to avoid migration --- .../certificates/migrations/0001_initial.py | 20 +++++++++---------- .../migrations/0005_auto_20151208_0801.py | 2 +- .../migrations/0015_add_masters_choice.py | 4 ++-- lms/djangoapps/certificates/models.py | 18 ++++++++--------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lms/djangoapps/certificates/migrations/0001_initial.py b/lms/djangoapps/certificates/migrations/0001_initial.py index 63512c196a..a78e07b50e 100644 --- a/lms/djangoapps/certificates/migrations/0001_initial.py +++ b/lms/djangoapps/certificates/migrations/0001_initial.py @@ -71,7 +71,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), ('enabled', models.BooleanField(default=False, verbose_name='Enabled')), - ('configuration', models.TextField(help_text=b'Certificate HTML View Parameters (JSON)')), + ('configuration', models.TextField(help_text=u'Certificate HTML View Parameters (JSON)')), ('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), ], options={ @@ -132,7 +132,7 @@ class Migration(migrations.Migration): ('access_key', models.CharField(default=cert_models._make_uuid, help_text='An access key for the example certificate. This is used when we receive a response from the queue to validate that the sender is the same entity we asked to generate the certificate.', max_length=255, db_index=True)), ('full_name', models.CharField(default='John Do\xeb', help_text='The full name that will appear on the certificate.', max_length=255)), ('template', models.CharField(help_text='The template file to use when generating the certificate.', max_length=255)), - ('status', models.CharField(default=b'started', help_text='The status of the example certificate.', max_length=255, choices=[(b'started', b'Started'), (b'success', b'Success'), (b'error', b'Error')])), + ('status', models.CharField(default=u'started', help_text='The status of the example certificate.', max_length=255, choices=[(u'started', u'Started'), (u'success', u'Success'), (u'error', u'Error')])), ('error_reason', models.TextField(default=None, help_text='The reason an error occurred during certificate generation.', null=True)), ('download_url', models.CharField(default=None, max_length=255, null=True, help_text='The download URL for the generated certificate.')), ], @@ -154,18 +154,18 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('course_id', CourseKeyField(default=None, max_length=255, blank=True)), - ('verify_uuid', models.CharField(default=b'', max_length=32, blank=True)), - ('download_uuid', models.CharField(default=b'', max_length=32, blank=True)), - ('download_url', models.CharField(default=b'', max_length=128, blank=True)), - ('grade', models.CharField(default=b'', max_length=5, blank=True)), - ('key', models.CharField(default=b'', max_length=32, blank=True)), + ('verify_uuid', models.CharField(default=u'', max_length=32, blank=True)), + ('download_uuid', models.CharField(default=u'', max_length=32, blank=True)), + ('download_url', models.CharField(default=u'', max_length=128, blank=True)), + ('grade', models.CharField(default=u'', max_length=5, blank=True)), + ('key', models.CharField(default=u'', max_length=32, blank=True)), ('distinction', models.BooleanField(default=False)), - ('status', models.CharField(default=b'unavailable', max_length=32)), - ('mode', models.CharField(default=b'honor', max_length=32, choices=[(b'verified', b'verified'), (b'honor', b'honor'), (b'audit', b'audit'), (b'professional', b'professional'), (b'no-id-professional', b'no-id-professional')])), + ('status', models.CharField(default=u'unavailable', max_length=32)), + ('mode', models.CharField(default=u'honor', max_length=32, choices=[(u'verified', u'verified'), (u'honor', u'honor'), (u'audit', u'audit'), (u'professional', u'professional'), (u'no-id-professional', u'no-id-professional')])), ('name', models.CharField(max_length=255, blank=True)), ('created_date', models.DateTimeField(auto_now_add=True)), ('modified_date', models.DateTimeField(auto_now=True)), - ('error_reason', models.CharField(default=b'', max_length=512, blank=True)), + ('error_reason', models.CharField(default=u'', max_length=512, blank=True)), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), diff --git a/lms/djangoapps/certificates/migrations/0005_auto_20151208_0801.py b/lms/djangoapps/certificates/migrations/0005_auto_20151208_0801.py index f0082121c3..ddd4b0e3e6 100644 --- a/lms/djangoapps/certificates/migrations/0005_auto_20151208_0801.py +++ b/lms/djangoapps/certificates/migrations/0005_auto_20151208_0801.py @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='generatedcertificate', name='verify_uuid', - field=models.CharField(default=b'', max_length=32, db_index=True, blank=True), + field=models.CharField(default=u'', max_length=32, db_index=True, blank=True), ), ] diff --git a/lms/djangoapps/certificates/migrations/0015_add_masters_choice.py b/lms/djangoapps/certificates/migrations/0015_add_masters_choice.py index c02981efb9..014e782cbb 100644 --- a/lms/djangoapps/certificates/migrations/0015_add_masters_choice.py +++ b/lms/djangoapps/certificates/migrations/0015_add_masters_choice.py @@ -15,11 +15,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='certificatetemplate', name='mode', - field=models.CharField(blank=True, choices=[(b'verified', b'verified'), (b'honor', b'honor'), (b'audit', b'audit'), (b'professional', b'professional'), (b'no-id-professional', b'no-id-professional'), (b'masters', b'masters')], default=b'honor', help_text='The course mode for this template.', max_length=125, null=True), + field=models.CharField(blank=True, choices=[(u'verified', u'verified'), (u'honor', u'honor'), (u'audit', u'audit'), (u'professional', u'professional'), (u'no-id-professional', u'no-id-professional'), (u'masters', u'masters')], default=u'honor', help_text='The course mode for this template.', max_length=125, null=True), ), migrations.AlterField( model_name='generatedcertificate', name='mode', - field=models.CharField(choices=[(b'verified', b'verified'), (b'honor', b'honor'), (b'audit', b'audit'), (b'professional', b'professional'), (b'no-id-professional', b'no-id-professional'), (b'masters', b'masters')], default=b'honor', max_length=32), + field=models.CharField(choices=[(u'verified', u'verified'), (u'honor', u'honor'), (u'audit', u'audit'), (u'professional', u'professional'), (u'no-id-professional', u'no-id-professional'), (u'masters', u'masters')], default=u'honor', max_length=32), ), ] diff --git a/lms/djangoapps/certificates/models.py b/lms/djangoapps/certificates/models.py index 6a0737a5f7..e7ee233246 100644 --- a/lms/djangoapps/certificates/models.py +++ b/lms/djangoapps/certificates/models.py @@ -261,7 +261,7 @@ class GeneratedCertificate(models.Model): # results. Django requires us to explicitly declare this. objects = models.Manager() - MODES = Choices('verified', 'honor', 'audit', 'professional', 'no-id-professional', 'masters') + MODES = Choices(u'verified', u'honor', u'audit', u'professional', u'no-id-professional', u'masters') VERIFIED_CERTS_MODES = [CourseMode.VERIFIED, CourseMode.CREDIT_MODE, CourseMode.MASTERS] @@ -273,7 +273,7 @@ class GeneratedCertificate(models.Model): grade = models.CharField(max_length=5, blank=True, default='') key = models.CharField(max_length=32, blank=True, default='') distinction = models.BooleanField(default=False) - status = models.CharField(max_length=32, default='unavailable') + status = models.CharField(max_length=32, default=u'unavailable') mode = models.CharField(max_length=32, choices=MODES, default=MODES.honor) name = models.CharField(blank=True, max_length=255) created_date = models.DateTimeField(auto_now_add=True) @@ -766,9 +766,9 @@ class ExampleCertificate(TimeStampedModel): app_label = "certificates" # Statuses - STATUS_STARTED = 'started' - STATUS_SUCCESS = 'success' - STATUS_ERROR = 'error' + STATUS_STARTED = u'started' + STATUS_SUCCESS = u'success' + STATUS_ERROR = u'error' # Dummy full name for the generated certificate EXAMPLE_FULL_NAME = u'John Doƫ' @@ -827,9 +827,9 @@ class ExampleCertificate(TimeStampedModel): max_length=255, default=STATUS_STARTED, choices=( - (STATUS_STARTED, 'Started'), - (STATUS_SUCCESS, 'Success'), - (STATUS_ERROR, 'Error') + (STATUS_STARTED, u'Started'), + (STATUS_SUCCESS, u'Success'), + (STATUS_ERROR, u'Error') ), help_text=_(u"The status of the example certificate.") ) @@ -1048,7 +1048,7 @@ class CertificateHtmlViewConfiguration(ConfigurationModel): app_label = "certificates" configuration = models.TextField( - help_text="Certificate HTML View Parameters (JSON)" + help_text=u"Certificate HTML View Parameters (JSON)" ) def clean(self):