diff --git a/common/djangoapps/entitlements/migrations/0001_initial.py b/common/djangoapps/entitlements/migrations/0001_initial.py index 1e0de21f29..0fd7abf927 100644 --- a/common/djangoapps/entitlements/migrations/0001_initial.py +++ b/common/djangoapps/entitlements/migrations/0001_initial.py @@ -26,7 +26,7 @@ class Migration(migrations.Migration): ('uuid', models.UUIDField(default=uuid.uuid4, editable=False)), ('course_uuid', models.UUIDField()), ('expired_at', models.DateTimeField(null=True)), - ('mode', models.CharField(default=b'audit', max_length=100)), + ('mode', models.CharField(default=u'audit', max_length=100)), ('order_number', models.CharField(max_length=128, null=True)), ('enrollment_course_run', models.ForeignKey(to='student.CourseEnrollment', null=True, on_delete=models.CASCADE)), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), diff --git a/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py b/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py index a323701765..02c46b3cc4 100644 --- a/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py +++ b/common/djangoapps/entitlements/migrations/0002_auto_20171102_0719.py @@ -17,21 +17,21 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='courseentitlement', name='course_uuid', - field=models.UUIDField(help_text=b'UUID for the Course, not the Course Run'), + field=models.UUIDField(help_text=u'UUID for the Course, not the Course Run'), ), migrations.AlterField( model_name='courseentitlement', name='enrollment_course_run', - field=models.ForeignKey(to='student.CourseEnrollment', help_text=b'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), + field=models.ForeignKey(to='student.CourseEnrollment', help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), ), migrations.AlterField( model_name='courseentitlement', name='expired_at', - field=models.DateTimeField(help_text=b'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True), + field=models.DateTimeField(help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True), ), migrations.AlterField( model_name='courseentitlement', name='mode', - field=models.CharField(help_text=b'The mode of the Course that will be applied on enroll.', max_length=100), + field=models.CharField(help_text=u'The mode of the Course that will be applied on enroll.', max_length=100), ), ] diff --git a/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py b/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py index aa798572c9..7a708c22df 100644 --- a/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py +++ b/common/djangoapps/entitlements/migrations/0003_auto_20171205_1431.py @@ -18,21 +18,21 @@ class Migration(migrations.Migration): name='CourseEntitlementPolicy', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('expiration_period', models.DurationField(default=datetime.timedelta(450), help_text=b'Duration in days from when an entitlement is created until when it is expired.')), - ('refund_period', models.DurationField(default=datetime.timedelta(60), help_text=b'Duration in days from when an entitlement is created until when it is no longer refundable')), - ('regain_period', models.DurationField(default=datetime.timedelta(14), help_text=b'Duration in days from when an entitlement is redeemed for a course run until it is no longer able to be regained by a user.')), + ('expiration_period', models.DurationField(default=datetime.timedelta(450), help_text=u'Duration in days from when an entitlement is created until when it is expired.')), + ('refund_period', models.DurationField(default=datetime.timedelta(60), help_text=u'Duration in days from when an entitlement is created until when it is no longer refundable')), + ('regain_period', models.DurationField(default=datetime.timedelta(14), help_text=u'Duration in days from when an entitlement is redeemed for a course run until it is no longer able to be regained by a user.')), ('site', models.ForeignKey(to='sites.Site', on_delete=models.CASCADE)), ], ), migrations.AlterField( model_name='courseentitlement', name='enrollment_course_run', - field=models.ForeignKey(blank=True, to='student.CourseEnrollment', help_text=b'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), + field=models.ForeignKey(blank=True, to='student.CourseEnrollment', help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=models.CASCADE), ), migrations.AlterField( model_name='courseentitlement', name='expired_at', - field=models.DateTimeField(help_text=b'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True, blank=True), + field=models.DateTimeField(help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True, blank=True), ), migrations.AddField( model_name='courseentitlement', diff --git a/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py b/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py index 6c4ea35b69..d21ca03472 100644 --- a/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py +++ b/common/djangoapps/entitlements/migrations/0005_courseentitlementsupportdetail.py @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), - ('reason', models.CharField(max_length=15, choices=[(b'LEAVE', 'Learner requested leave session for expired entitlement'), (b'CHANGE', 'Learner requested session change for expired entitlement'), (b'LEARNER_NEW', 'Learner requested new entitlement'), (b'COURSE_TEAM_NEW', 'Course team requested entitlement for learnerg'), (b'OTHER', 'Other')])), + ('reason', models.CharField(max_length=15, choices=[(u'LEAVE', 'Learner requested leave session for expired entitlement'), (u'CHANGE', 'Learner requested session change for expired entitlement'), (u'LEARNER_NEW', 'Learner requested new entitlement'), (u'COURSE_TEAM_NEW', 'Course team requested entitlement for learnerg'), (u'OTHER', 'Other')])), ('comments', models.TextField(null=True)), ('entitlement', models.ForeignKey(to='entitlements.CourseEntitlement', on_delete=models.CASCADE)), ('support_user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), diff --git a/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py b/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py index 837c94480e..b401a07e11 100644 --- a/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py +++ b/common/djangoapps/entitlements/migrations/0006_courseentitlementsupportdetail_action.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='courseentitlementsupportdetail', name='action', - field=models.CharField(default='CREATE', max_length=15, choices=[(b'REISSUE', b'Re-issue entitlement'), (b'CREATE', b'Create new entitlement')]), + field=models.CharField(default='CREATE', max_length=15, choices=[(u'REISSUE', u'Re-issue entitlement'), (u'CREATE', u'Create new entitlement')]), preserve_default=False, ), ] diff --git a/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py b/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py index 8409783c15..64af1f1b66 100644 --- a/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py +++ b/common/djangoapps/entitlements/migrations/0007_change_expiration_period_default.py @@ -16,6 +16,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='courseentitlementpolicy', name='expiration_period', - field=models.DurationField(default=datetime.timedelta(730), help_text=b'Duration in days from when an entitlement is created until when it is expired.'), + field=models.DurationField(default=datetime.timedelta(730), help_text=u'Duration in days from when an entitlement is created until when it is expired.'), ), ] diff --git a/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py b/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py index a67cc80ab3..63783d8ecf 100644 --- a/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py +++ b/common/djangoapps/entitlements/migrations/0008_auto_20180328_1107.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='courseentitlementpolicy', name='mode', - field=models.CharField(max_length=32, null=True, choices=[(None, b'---------'), (b'verified', b'verified'), (b'professional', b'professional')]), + field=models.CharField(max_length=32, null=True, choices=[(None, u'---------'), (u'verified', u'verified'), (u'professional', u'professional')]), ), migrations.AlterField( model_name='courseentitlementpolicy', diff --git a/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py b/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py index 9981d8e834..cb606f7d8f 100644 --- a/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py +++ b/common/djangoapps/entitlements/migrations/0011_historicalcourseentitlement.py @@ -27,9 +27,9 @@ class Migration(migrations.Migration): ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)), - ('course_uuid', models.UUIDField(help_text=b'UUID for the Course, not the Course Run')), - ('expired_at', models.DateTimeField(blank=True, help_text=b'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True)), - ('mode', models.CharField(help_text=b'The mode of the Course that will be applied on enroll.', max_length=100)), + ('course_uuid', models.UUIDField(help_text=u'UUID for the Course, not the Course Run')), + ('expired_at', models.DateTimeField(blank=True, help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', null=True)), + ('mode', models.CharField(help_text=u'The mode of the Course that will be applied on enroll.', max_length=100)), ('order_number', models.CharField(max_length=128, null=True)), ('refund_locked', models.BooleanField(default=False)), ('history_id', models.AutoField(primary_key=True, serialize=False)), @@ -37,7 +37,7 @@ class Migration(migrations.Migration): ('history_change_reason', models.CharField(max_length=100, null=True)), ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), ('_policy', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='entitlements.CourseEntitlementPolicy')), - ('enrollment_course_run', models.ForeignKey(blank=True, db_constraint=False, help_text=b'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='student.CourseEnrollment')), + ('enrollment_course_run', models.ForeignKey(blank=True, db_constraint=False, help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='student.CourseEnrollment')), ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), ], diff --git a/common/djangoapps/entitlements/models.py b/common/djangoapps/entitlements/models.py index 364d43f454..8549de317b 100644 --- a/common/djangoapps/entitlements/models.py +++ b/common/djangoapps/entitlements/models.py @@ -38,23 +38,23 @@ class CourseEntitlementPolicy(models.Model): DEFAULT_EXPIRATION_PERIOD_DAYS = 730 DEFAULT_REFUND_PERIOD_DAYS = 60 DEFAULT_REGAIN_PERIOD_DAYS = 14 - MODES = Choices((None, '---------'), CourseMode.VERIFIED, CourseMode.PROFESSIONAL) + MODES = Choices((None, u'---------'), CourseMode.VERIFIED, CourseMode.PROFESSIONAL) # Use a DurationField to calculate time as it returns a timedelta, useful in performing operations with datetimes expiration_period = models.DurationField( default=timedelta(days=DEFAULT_EXPIRATION_PERIOD_DAYS), - help_text="Duration in days from when an entitlement is created until when it is expired.", + help_text=u"Duration in days from when an entitlement is created until when it is expired.", null=False ) refund_period = models.DurationField( default=timedelta(days=DEFAULT_REFUND_PERIOD_DAYS), - help_text="Duration in days from when an entitlement is created until when it is no longer refundable", + help_text=u"Duration in days from when an entitlement is created until when it is no longer refundable", null=False ) regain_period = models.DurationField( default=timedelta(days=DEFAULT_REGAIN_PERIOD_DAYS), - help_text=("Duration in days from when an entitlement is redeemed for a course run until " - "it is no longer able to be regained by a user."), + help_text=(u"Duration in days from when an entitlement is redeemed for a course run until " + u"it is no longer able to be regained by a user."), null=False ) site = models.ForeignKey(Site, null=True, on_delete=models.CASCADE) @@ -158,17 +158,17 @@ class CourseEntitlement(TimeStampedModel): """ user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) uuid = models.UUIDField(default=uuid_tools.uuid4, editable=False, unique=True) - course_uuid = models.UUIDField(help_text='UUID for the Course, not the Course Run') + course_uuid = models.UUIDField(help_text=u'UUID for the Course, not the Course Run') expired_at = models.DateTimeField( null=True, - help_text='The date that an entitlement expired, if NULL the entitlement has not expired.', + help_text=u'The date that an entitlement expired, if NULL the entitlement has not expired.', blank=True ) - mode = models.CharField(max_length=100, help_text='The mode of the Course that will be applied on enroll.') + mode = models.CharField(max_length=100, help_text=u'The mode of the Course that will be applied on enroll.') enrollment_course_run = models.ForeignKey( 'student.CourseEnrollment', null=True, - help_text='The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', + help_text=u'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.', blank=True, on_delete=models.CASCADE, ) @@ -458,11 +458,11 @@ class CourseEntitlementSupportDetail(TimeStampedModel): .. no_pii: """ # Reasons deprecated - LEAVE_SESSION = 'LEAVE' - CHANGE_SESSION = 'CHANGE' - LEARNER_REQUEST_NEW = 'LEARNER_NEW' - COURSE_TEAM_REQUEST_NEW = 'COURSE_TEAM_NEW' - OTHER = 'OTHER' + LEAVE_SESSION = u'LEAVE' + CHANGE_SESSION = u'CHANGE' + LEARNER_REQUEST_NEW = u'LEARNER_NEW' + COURSE_TEAM_REQUEST_NEW = u'COURSE_TEAM_NEW' + OTHER = u'OTHER' ENTITLEMENT_SUPPORT_REASONS = ( (LEAVE_SESSION, u'Learner requested leave session for expired entitlement'), (CHANGE_SESSION, u'Learner requested session change for expired entitlement'), @@ -471,11 +471,11 @@ class CourseEntitlementSupportDetail(TimeStampedModel): (OTHER, u'Other'), ) - REISSUE = 'REISSUE' - CREATE = 'CREATE' + REISSUE = u'REISSUE' + CREATE = u'CREATE' ENTITLEMENT_SUPPORT_ACTIONS = ( - (REISSUE, 'Re-issue entitlement'), - (CREATE, 'Create new entitlement'), + (REISSUE, u'Re-issue entitlement'), + (CREATE, u'Create new entitlement'), ) entitlement = models.ForeignKey('entitlements.CourseEntitlement', on_delete=models.CASCADE)