BOM-933: Fix type mismatches in various migrations 2 (#22115)

* Fix type mismatches in track migrations

* Fix type mismatches in oauth_dispatch

* Fix type mismatches in badges migrations

* fix type mismatch in contentserver migrations

* Fix type mismatches in mobile_api migrations

* fix type mismatch in crawlers migrations

* fix type mismatch in dark_lang migrations

* fix type mismatch in branding  migrations
This commit is contained in:
Manjinder Singh
2019-10-23 13:04:36 -04:00
committed by GitHub
parent 6e0914ad5d
commit a40f1d9bd6
22 changed files with 46 additions and 46 deletions

View File

@@ -42,7 +42,7 @@ class TrackingLog(models.Model):
.. pii_retirement: retained
"""
dtcreated = models.DateTimeField('creation date', auto_now_add=True)
dtcreated = models.DateTimeField(u'creation date', auto_now_add=True)
username = models.CharField(max_length=32, blank=True)
ip = models.CharField(max_length=32, blank=True)
event_source = models.CharField(max_length=32)
@@ -50,7 +50,7 @@ class TrackingLog(models.Model):
event = models.TextField(blank=True)
agent = models.CharField(max_length=256, blank=True)
page = models.CharField(max_length=512, blank=True, null=True)
time = models.DateTimeField('event time')
time = models.DateTimeField(u'event time')
host = models.CharField(max_length=64, blank=True)
class Meta(object):

View File

@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
name='TrackingLog',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('dtcreated', models.DateTimeField(auto_now_add=True, verbose_name=b'creation date')),
('dtcreated', models.DateTimeField(auto_now_add=True, verbose_name=u'creation date')),
('username', models.CharField(max_length=32, blank=True)),
('ip', models.CharField(max_length=32, blank=True)),
('event_source', models.CharField(max_length=32)),
@@ -22,7 +22,7 @@ class Migration(migrations.Migration):
('event', models.TextField(blank=True)),
('agent', models.CharField(max_length=256, blank=True)),
('page', models.CharField(max_length=512, null=True, blank=True)),
('time', models.DateTimeField(verbose_name=b'event time')),
('time', models.DateTimeField(verbose_name=u'event time')),
('host', models.CharField(max_length=64, blank=True)),
],
options={

View File

@@ -35,13 +35,13 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('slug', models.SlugField(max_length=255, validators=[badges.models.validate_lowercase])),
('issuing_component', models.SlugField(default=b'', blank=True, validators=[badges.models.validate_lowercase])),
('issuing_component', models.SlugField(default=u'', blank=True, validators=[badges.models.validate_lowercase])),
('display_name', models.CharField(max_length=255)),
('course_id', CourseKeyField(default=None, max_length=255, blank=True)),
('description', models.TextField()),
('criteria', models.TextField()),
('mode', models.CharField(default=b'', max_length=100, blank=True)),
('image', models.ImageField(upload_to=b'badge_classes', validators=[badges.models.validate_badge_image])),
('mode', models.CharField(default=u'', max_length=100, blank=True)),
('image', models.ImageField(upload_to=u'badge_classes', validators=[badges.models.validate_badge_image])),
],
),
migrations.CreateModel(
@@ -49,7 +49,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('mode', models.CharField(help_text='The course mode for this badge image. For example, "verified" or "honor".', unique=True, max_length=125)),
('icon', models.ImageField(help_text='Badge images must be square PNG files. The file size should be under 250KB.', upload_to=b'course_complete_badges', validators=[badges.models.validate_badge_image])),
('icon', models.ImageField(help_text='Badge images must be square PNG files. The file size should be under 250KB.', upload_to=u'course_complete_badges', validators=[badges.models.validate_badge_image])),
('default', models.BooleanField(default=False, help_text='Set this value to True if you want this image to be the default image for any course modes that do not have a specified badge image. You can have only one default image.')),
],
),

View File

@@ -20,9 +20,9 @@ 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')),
('courses_completed', models.TextField(default=b'', help_text="On each line, put the number of completed courses to award a badge for, a comma, and the slug of a badge class you have created that has the issuing component 'openedx__course'. For example: 3,enrolled_3_courses", blank=True)),
('courses_enrolled', models.TextField(default=b'', help_text="On each line, put the number of enrolled courses to award a badge for, a comma, and the slug of a badge class you have created that has the issuing component 'openedx__course'. For example: 3,enrolled_3_courses", blank=True)),
('course_groups', models.TextField(default=b'', help_text="Each line is a comma-separated list. The first item in each line is the slug of a badge class you have created that has an issuing component of 'openedx__course'. The remaining items in each line are the course keys the learner needs to complete to be awarded the badge. For example: slug_for_compsci_courses_group_badge,course-v1:CompSci+Course+First,course-v1:CompsSci+Course+Second", blank=True)),
('courses_completed', models.TextField(default=u'', help_text="On each line, put the number of completed courses to award a badge for, a comma, and the slug of a badge class you have created that has the issuing component 'openedx__course'. For example: 3,enrolled_3_courses", blank=True)),
('courses_enrolled', models.TextField(default=u'', help_text="On each line, put the number of enrolled courses to award a badge for, a comma, and the slug of a badge class you have created that has the issuing component 'openedx__course'. For example: 3,enrolled_3_courses", blank=True)),
('course_groups', models.TextField(default=u'', help_text="Each line is a comma-separated list. The first item in each line is the slug of a badge class you have created that has an issuing component of 'openedx__course'. The remaining items in each line are the course keys the learner needs to complete to be awarded the badge. For example: slug_for_compsci_courses_group_badge,course-v1:CompSci+Course+First,course-v1:CompsSci+Course+Second", 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')),
],
),

View File

@@ -57,14 +57,14 @@ class BadgeClass(models.Model):
.. no_pii:
"""
slug = models.SlugField(max_length=255, validators=[validate_lowercase])
issuing_component = models.SlugField(max_length=50, default='', blank=True, validators=[validate_lowercase])
issuing_component = models.SlugField(max_length=50, default=u'', blank=True, validators=[validate_lowercase])
display_name = models.CharField(max_length=255)
course_id = CourseKeyField(max_length=255, blank=True, default=None)
description = models.TextField()
criteria = models.TextField()
# Mode a badge was awarded for. Included for legacy/migration purposes.
mode = models.CharField(max_length=100, default='', blank=True)
image = models.ImageField(upload_to='badge_classes', validators=[validate_badge_image])
mode = models.CharField(max_length=100, default=u'', blank=True)
image = models.ImageField(upload_to=u'badge_classes', validators=[validate_badge_image])
def __str__(self):
return HTML(u"<Badge '{slug}' for '{issuing_component}'>").format(
@@ -200,7 +200,7 @@ class CourseCompleteImageConfiguration(models.Model):
help_text=_(
u"Badge images must be square PNG files. The file size should be under 250KB."
),
upload_to='course_complete_badges',
upload_to=u'course_complete_badges',
validators=[validate_badge_image]
)
default = models.BooleanField(
@@ -248,7 +248,7 @@ class CourseEventBadgesConfiguration(ConfigurationModel):
.. no_pii:
"""
courses_completed = models.TextField(
blank=True, default='',
blank=True, default=u'',
help_text=_(
u"On each line, put the number of completed courses to award a badge for, a comma, and the slug of a "
u"badge class you have created that has the issuing component 'openedx__course'. "
@@ -256,7 +256,7 @@ class CourseEventBadgesConfiguration(ConfigurationModel):
)
)
courses_enrolled = models.TextField(
blank=True, default='',
blank=True, default=u'',
help_text=_(
u"On each line, put the number of enrolled courses to award a badge for, a comma, and the slug of a "
u"badge class you have created that has the issuing component 'openedx__course'. "
@@ -264,7 +264,7 @@ class CourseEventBadgesConfiguration(ConfigurationModel):
)
)
course_groups = models.TextField(
blank=True, default='',
blank=True, default=u'',
help_text=_(
u"Each line is a comma-separated list. The first item in each line is the slug of a badge class you "
u"have created that has an issuing component of 'openedx__course'. The remaining items in each line are "

View File

@@ -33,7 +33,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'JSON data of Configuration for Video Branding.')),
('configuration', models.TextField(help_text=u'JSON data of Configuration for Video Branding.')),
('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={

View File

@@ -33,7 +33,7 @@ class BrandingInfoConfig(ConfigurationModel):
app_label = "branding"
configuration = TextField(
help_text="JSON data of Configuration for Video Branding."
help_text=u"JSON data of Configuration for Video Branding."
)
def clean(self):

View File

@@ -19,7 +19,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')),
('video_profiles', models.TextField(help_text=b'A comma-separated list of names of profiles to include for videos returned from the mobile API.', blank=True)),
('video_profiles', models.TextField(help_text=u'A comma-separated list of names of profiles to include for videos returned from the mobile API.', 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={

View File

@@ -15,12 +15,12 @@ class Migration(migrations.Migration):
name='AppVersionConfig',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('platform', models.CharField(max_length=50, choices=[(b'Android', b'Android'), (b'iOS', b'iOS')])),
('version', models.CharField(help_text=b'Version should be in the format X.X.X.Y where X is a number and Y is alphanumeric', max_length=50)),
('platform', models.CharField(max_length=50, choices=[(u'Android', u'Android'), (u'iOS', u'iOS')])),
('version', models.CharField(help_text=u'Version should be in the format X.X.X.Y where X is a number and Y is alphanumeric', max_length=50)),
('major_version', models.IntegerField()),
('minor_version', models.IntegerField()),
('patch_version', models.IntegerField()),
('expire_at', models.DateTimeField(null=True, verbose_name=b'Expiry date for platform version', blank=True)),
('expire_at', models.DateTimeField(null=True, verbose_name=u'Expiry date for platform version', blank=True)),
('enabled', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),

View File

@@ -58,14 +58,14 @@ class IOS(MobilePlatform):
""" iOS platform """
USER_AGENT_REGEX = (r'\((?P<version>[0-9]+.[0-9]+.[0-9]+(\.[0-9a-zA-Z]*)?); OS Version [0-9.]+ '
r'\(Build [0-9a-zA-Z]*\)\)')
NAME = "iOS"
NAME = u"iOS"
class Android(MobilePlatform):
""" Android platform """
USER_AGENT_REGEX = (r'Dalvik/[.0-9]+ \(Linux; U; Android [.0-9]+; (.*) Build/[0-9a-zA-Z]*\) '
r'(.*)/(?P<version>[0-9]+.[0-9]+.[0-9]+(\.[0-9a-zA-Z]*)?)')
NAME = "Android"
NAME = u"Android"
# a list of all supported mobile platforms

View File

@@ -22,7 +22,7 @@ class MobileApiConfig(ConfigurationModel):
"""
video_profiles = models.TextField(
blank=True,
help_text="A comma-separated list of names of profiles to include for videos returned from the mobile API."
help_text=u"A comma-separated list of names of profiles to include for videos returned from the mobile API."
)
class Meta(object):
@@ -51,12 +51,12 @@ class AppVersionConfig(models.Model):
version = models.CharField(
max_length=50,
blank=False,
help_text="Version should be in the format X.X.X.Y where X is a number and Y is alphanumeric"
help_text=u"Version should be in the format X.X.X.Y where X is a number and Y is alphanumeric"
)
major_version = models.IntegerField()
minor_version = models.IntegerField()
patch_version = models.IntegerField()
expire_at = models.DateTimeField(null=True, blank=True, verbose_name="Expiry date for platform version")
expire_at = models.DateTimeField(null=True, blank=True, verbose_name=u"Expiry date for platform version")
enabled = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

View File

@@ -20,7 +20,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')),
('cache_ttl', models.PositiveIntegerField(default=0, help_text=b'The time, in seconds, to report that a course asset is allowed to be cached for.')),
('cache_ttl', models.PositiveIntegerField(default=0, help_text=u'The time, in seconds, to report that a course asset is allowed to be cached for.')),
('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')),
],
),

View File

@@ -20,7 +20,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')),
('cdn_user_agents', models.TextField(default=b'Amazon CloudFront', help_text=b'A newline-separated list of user agents that should be considered CDNs.')),
('cdn_user_agents', models.TextField(default=u'Amazon CloudFront', help_text=u'A newline-separated list of user agents that should be considered CDNs.')),
('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')),
],
),

View File

@@ -24,7 +24,7 @@ class CourseAssetCacheTtlConfig(ConfigurationModel):
cache_ttl = PositiveIntegerField(
default=0,
help_text="The time, in seconds, to report that a course asset is allowed to be cached for."
help_text=u"The time, in seconds, to report that a course asset is allowed to be cached for."
)
@classmethod
@@ -51,8 +51,8 @@ class CdnUserAgentsConfig(ConfigurationModel):
app_label = 'contentserver'
cdn_user_agents = TextField(
default='Amazon CloudFront',
help_text="A newline-separated list of user agents that should be considered CDNs."
default=u'Amazon CloudFront',
help_text=u"A newline-separated list of user agents that should be considered CDNs."
)
@classmethod

View File

@@ -19,7 +19,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')),
('known_user_agents', models.TextField(default=b'edX-downloader', help_text=b'A comma-separated list of known crawler user agents.', blank=True)),
('known_user_agents', models.TextField(default=u'edX-downloader', help_text=u'A comma-separated list of known crawler user agents.', 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={

View File

@@ -22,8 +22,8 @@ class CrawlersConfig(ConfigurationModel):
known_user_agents = models.TextField(
blank=True,
help_text="A comma-separated list of known crawler user agents.",
default='edX-downloader',
help_text=u"A comma-separated list of known crawler user agents.",
default=u'edX-downloader',
)
def __str__(self):

View File

@@ -19,7 +19,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')),
('released_languages', models.TextField(help_text=b'A comma-separated list of language codes to release to the public.', blank=True)),
('released_languages', models.TextField(help_text=u'A comma-separated list of language codes to release to the public.', 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={

View File

@@ -15,11 +15,11 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='darklangconfig',
name='beta_languages',
field=models.TextField(blank=True, help_text=b'A comma-separated list of language codes to release to the public as beta languages.'),
field=models.TextField(blank=True, help_text=u'A comma-separated list of language codes to release to the public as beta languages.'),
),
migrations.AddField(
model_name='darklangconfig',
name='enable_beta_languages',
field=models.BooleanField(default=False, help_text=b'Enable partially supported languages to display in language drop down.'),
field=models.BooleanField(default=False, help_text=u'Enable partially supported languages to display in language drop down.'),
),
]

View File

@@ -17,15 +17,15 @@ class DarkLangConfig(ConfigurationModel):
"""
released_languages = models.TextField(
blank=True,
help_text="A comma-separated list of language codes to release to the public."
help_text=u"A comma-separated list of language codes to release to the public."
)
enable_beta_languages = models.BooleanField(
default=False,
help_text="Enable partially supported languages to display in language drop down."
help_text=u"Enable partially supported languages to display in language drop down."
)
beta_languages = models.TextField(
blank=True,
help_text="A comma-separated list of language codes to release to the public as beta languages."
help_text=u"A comma-separated list of language codes to release to the public as beta languages."
)
def __str__(self):

View File

@@ -39,7 +39,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('short_name', models.CharField(help_text='The short_name of an existing Organization.', max_length=255)),
('provider_type', models.CharField(choices=[(b'content_org', 'Content Provider')], default=b'content_org', max_length=32)),
('provider_type', models.CharField(choices=[(u'content_org', 'Content Provider')], default=u'content_org', max_length=32)),
('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organizations', to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)),
],
),

View File

@@ -29,7 +29,7 @@ class Migration(migrations.Migration):
name='ApplicationOrganization',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('relation_type', models.CharField(choices=[(b'content_org', 'Content Provider')], default=b'content_org', max_length=32)),
('relation_type', models.CharField(choices=[(u'content_org', 'Content Provider')], default=u'content_org', max_length=32)),
('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organizations', to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)),
('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organizations.Organization')),
],

View File

@@ -104,7 +104,7 @@ class ApplicationOrganization(models.Model):
.. no_pii:
"""
RELATION_TYPE_CONTENT_ORG = 'content_org'
RELATION_TYPE_CONTENT_ORG = u'content_org'
RELATION_TYPES = (
(RELATION_TYPE_CONTENT_ORG, _('Content Provider')),
)