From 82fb16b2f7aa39bd3060edfa640366b296662bd4 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Thu, 24 Oct 2019 11:49:58 +0500 Subject: [PATCH] BOM-981,983,984 Fixing migrations. --- .../embargo/migrations/0001_initial.py | 12 ++++----- openedx/core/djangoapps/embargo/models.py | 26 +++++++++---------- .../migrations/0002_auto_20160720_0231.py | 4 +-- .../djangoapps/site_configuration/models.py | 4 +-- .../announcements/migrations/0001_initial.py | 2 +- openedx/features/announcements/models.py | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/openedx/core/djangoapps/embargo/migrations/0001_initial.py b/openedx/core/djangoapps/embargo/migrations/0001_initial.py index 8c1a88411e..a5d87b9d62 100644 --- a/openedx/core/djangoapps/embargo/migrations/0001_initial.py +++ b/openedx/core/djangoapps/embargo/migrations/0001_initial.py @@ -29,7 +29,7 @@ class Migration(migrations.Migration): name='CountryAccessRule', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('rule_type', models.CharField(default=b'blacklist', help_text='Whether to include or exclude the given course. If whitelist countries are specified, then ONLY users from whitelisted countries will be able to access the course. If blacklist countries are specified, then users from blacklisted countries will NOT be able to access the course.', max_length=255, choices=[(b'whitelist', b'Whitelist (allow only these countries)'), (b'blacklist', b'Blacklist (block these countries)')])), + ('rule_type', models.CharField(default=u'blacklist', help_text='Whether to include or exclude the given course. If whitelist countries are specified, then ONLY users from whitelisted countries will be able to access the course. If blacklist countries are specified, then users from blacklisted countries will NOT be able to access the course.', max_length=255, choices=[(u'whitelist', u'Whitelist (allow only these countries)'), (u'blacklist', u'Blacklist (block these countries)')])), ('country', models.ForeignKey(help_text='The country to which this rule applies.', to='embargo.Country', on_delete=models.CASCADE)), ], ), @@ -59,7 +59,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')), - ('embargoed_countries', models.TextField(help_text=b'A comma-separated list of country codes that fall under U.S. embargo restrictions', blank=True)), + ('embargoed_countries', models.TextField(help_text=u'A comma-separated list of country codes that fall under U.S. embargo restrictions', blank=True)), ('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={ @@ -73,8 +73,8 @@ 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')), - ('whitelist', models.TextField(help_text=b'A comma-separated list of IP addresses that should not fall under embargo restrictions.', blank=True)), - ('blacklist', models.TextField(help_text=b'A comma-separated list of IP addresses that should fall under embargo restrictions.', blank=True)), + ('whitelist', models.TextField(help_text=u'A comma-separated list of IP addresses that should not fall under embargo restrictions.', blank=True)), + ('blacklist', models.TextField(help_text=u'A comma-separated list of IP addresses that should fall under embargo restrictions.', blank=True)), ('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={ @@ -87,8 +87,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('course_key', CourseKeyField(help_text='The course key for the restricted course.', unique=True, max_length=255, db_index=True)), - ('enroll_msg_key', models.CharField(default=b'default', help_text='The message to show when a user is blocked from enrollment.', max_length=255, choices=[(b'default', b'Default'), (b'embargo', b'Embargo')])), - ('access_msg_key', models.CharField(default=b'default', help_text='The message to show when a user is blocked from accessing a course.', max_length=255, choices=[(b'default', b'Default'), (b'embargo', b'Embargo')])), + ('enroll_msg_key', models.CharField(default=u'default', help_text=u'The message to show when a user is blocked from enrollment.', max_length=255, choices=[(u'default', u'Default'), (u'embargo', u'Embargo')])), + ('access_msg_key', models.CharField(default=u'default', help_text=u'The message to show when a user is blocked from accessing a course.', max_length=255, choices=[(u'default', u'Default'), (u'embargo', u'Embargo')])), ('disable_access_check', models.BooleanField(default=False, help_text='Allow users who enrolled in an allowed country to access restricted courses from excluded countries.')), ], ), diff --git a/openedx/core/djangoapps/embargo/models.py b/openedx/core/djangoapps/embargo/models.py index 53b2c7d69b..87549814f3 100644 --- a/openedx/core/djangoapps/embargo/models.py +++ b/openedx/core/djangoapps/embargo/models.py @@ -88,7 +88,7 @@ class EmbargoedState(ConfigurationModel): # The countries to embargo embargoed_countries = models.TextField( blank=True, - help_text="A comma-separated list of country codes that fall under U.S. embargo restrictions" + help_text=u"A comma-separated list of country codes that fall under U.S. embargo restrictions" ) @property @@ -127,15 +127,15 @@ class RestrictedCourse(models.Model): COURSE_LIST_CACHE_KEY = 'embargo.restricted_courses' MESSAGE_URL_CACHE_KEY = 'embargo.message_url_path.{access_point}.{course_key}' - ENROLL_MSG_KEY_CHOICES = tuple([ + ENROLL_MSG_KEY_CHOICES = tuple(sorted([ (msg_key, msg.description) for msg_key, msg in six.iteritems(ENROLL_MESSAGES) - ]) + ])) - COURSEWARE_MSG_KEY_CHOICES = tuple([ + COURSEWARE_MSG_KEY_CHOICES = tuple(sorted([ (msg_key, msg.description) for msg_key, msg in six.iteritems(COURSEWARE_MESSAGES) - ]) + ])) course_key = CourseKeyField( max_length=255, db_index=True, unique=True, @@ -145,14 +145,14 @@ class RestrictedCourse(models.Model): enroll_msg_key = models.CharField( max_length=255, choices=ENROLL_MSG_KEY_CHOICES, - default='default', + default=u'default', help_text=ugettext_lazy(u"The message to show when a user is blocked from enrollment.") ) access_msg_key = models.CharField( max_length=255, choices=COURSEWARE_MSG_KEY_CHOICES, - default='default', + default=u'default', help_text=ugettext_lazy(u"The message to show when a user is blocked from accessing a course.") ) @@ -422,12 +422,12 @@ class CountryAccessRule(models.Model): .. no_pii: """ - WHITELIST_RULE = 'whitelist' - BLACKLIST_RULE = 'blacklist' + WHITELIST_RULE = u'whitelist' + BLACKLIST_RULE = u'blacklist' RULE_TYPE_CHOICES = ( - (WHITELIST_RULE, 'Whitelist (allow only these countries)'), - (BLACKLIST_RULE, 'Blacklist (block these countries)'), + (WHITELIST_RULE, u'Whitelist (allow only these countries)'), + (BLACKLIST_RULE, u'Blacklist (block these countries)'), ) rule_type = models.CharField( @@ -694,12 +694,12 @@ class IPFilter(ConfigurationModel): """ whitelist = models.TextField( blank=True, - help_text="A comma-separated list of IP addresses that should not fall under embargo restrictions." + help_text=u"A comma-separated list of IP addresses that should not fall under embargo restrictions." ) blacklist = models.TextField( blank=True, - help_text="A comma-separated list of IP addresses that should fall under embargo restrictions." + help_text=u"A comma-separated list of IP addresses that should fall under embargo restrictions." ) class IPFilterList(object): diff --git a/openedx/core/djangoapps/site_configuration/migrations/0002_auto_20160720_0231.py b/openedx/core/djangoapps/site_configuration/migrations/0002_auto_20160720_0231.py index 36c641924c..5922dbfe94 100644 --- a/openedx/core/djangoapps/site_configuration/migrations/0002_auto_20160720_0231.py +++ b/openedx/core/djangoapps/site_configuration/migrations/0002_auto_20160720_0231.py @@ -14,11 +14,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='siteconfiguration', name='enabled', - field=models.BooleanField(default=False, verbose_name=b'Enabled'), + field=models.BooleanField(default=False, verbose_name=u'Enabled'), ), migrations.AddField( model_name='siteconfigurationhistory', name='enabled', - field=models.BooleanField(default=False, verbose_name=b'Enabled'), + field=models.BooleanField(default=False, verbose_name=u'Enabled'), ), ] diff --git a/openedx/core/djangoapps/site_configuration/models.py b/openedx/core/djangoapps/site_configuration/models.py index 0be707f864..8a6745c3e4 100644 --- a/openedx/core/djangoapps/site_configuration/models.py +++ b/openedx/core/djangoapps/site_configuration/models.py @@ -30,7 +30,7 @@ class SiteConfiguration(models.Model): .. no_pii: """ site = models.OneToOneField(Site, related_name='configuration', on_delete=models.CASCADE) - enabled = models.BooleanField(default=False, verbose_name="Enabled") + enabled = models.BooleanField(default=False, verbose_name=u"Enabled") values = JSONField( null=False, blank=True, @@ -151,7 +151,7 @@ class SiteConfigurationHistory(TimeStampedModel): .. no_pii: """ site = models.ForeignKey(Site, related_name='configuration_histories', on_delete=models.CASCADE) - enabled = models.BooleanField(default=False, verbose_name="Enabled") + enabled = models.BooleanField(default=False, verbose_name=u"Enabled") values = JSONField( null=False, blank=True, diff --git a/openedx/features/announcements/migrations/0001_initial.py b/openedx/features/announcements/migrations/0001_initial.py index 522aafe268..3c33bcede9 100644 --- a/openedx/features/announcements/migrations/0001_initial.py +++ b/openedx/features/announcements/migrations/0001_initial.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): name='Announcement', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('content', models.CharField(default=b'lorem ipsum', max_length=1000)), + ('content', models.CharField(default=u'lorem ipsum', max_length=1000)), ('active', models.BooleanField(default=True)), ], ), diff --git a/openedx/features/announcements/models.py b/openedx/features/announcements/models.py index 295e1b10f2..375c8816fa 100644 --- a/openedx/features/announcements/models.py +++ b/openedx/features/announcements/models.py @@ -14,7 +14,7 @@ class Announcement(models.Model): class Meta(object): app_label = 'announcements' - content = models.CharField(max_length=1000, null=False, default="lorem ipsum") + content = models.CharField(max_length=1000, null=False, default=u"lorem ipsum") active = models.BooleanField(default=True) def __str__(self):