diff --git a/lms/djangoapps/shoppingcart/migrations/0001_initial.py b/lms/djangoapps/shoppingcart/migrations/0001_initial.py index fc79d98b49..4cc7dbd42b 100644 --- a/lms/djangoapps/shoppingcart/migrations/0001_initial.py +++ b/lms/djangoapps/shoppingcart/migrations/0001_initial.py @@ -116,7 +116,7 @@ class Migration(migrations.Migration): ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)), ('qty', models.IntegerField(default=1, help_text='The number of items sold.')), ('unit_price', models.DecimalField(default=0.0, help_text='The price per item sold, including discounts.', max_digits=30, decimal_places=2)), - ('currency', models.CharField(default=b'usd', help_text='Lower-case ISO currency codes', max_length=8)), + ('currency', models.CharField(default=u'usd', help_text='Lower-case ISO currency codes', max_length=8)), ], ), migrations.CreateModel( @@ -126,9 +126,9 @@ class Migration(migrations.Migration): ('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)), ('amount', models.DecimalField(default=0.0, help_text='The amount of the transaction. Use positive amounts for payments and negative amounts for refunds.', max_digits=30, decimal_places=2)), - ('currency', models.CharField(default=b'usd', help_text='Lower-case ISO currency codes', max_length=8)), + ('currency', models.CharField(default=u'usd', help_text='Lower-case ISO currency codes', max_length=8)), ('comments', models.TextField(help_text='Optional: provide additional information for this transaction', null=True, blank=True)), - ('status', models.CharField(default=b'started', help_text="The status of the payment or refund. 'started' means that payment is expected, but money has not yet been transferred. 'completed' means that the payment or refund was received. 'cancelled' means that payment or refund was expected, but was cancelled before money was transferred. ", max_length=32, choices=[(b'started', b'started'), (b'completed', b'completed'), (b'cancelled', b'cancelled')])), + ('status', models.CharField(default=u'started', help_text="The status of the payment or refund. 'started' means that payment is expected, but money has not yet been transferred. 'completed' means that the payment or refund was received. 'cancelled' means that payment or refund was expected, but was cancelled before money was transferred. ", max_length=32, choices=[(u'started', u'started'), (u'completed', u'completed'), (u'cancelled', u'cancelled')])), ('created_by', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ('invoice', models.ForeignKey(to='shoppingcart.Invoice', on_delete=models.CASCADE)), ('last_modified_by', models.ForeignKey(related_name='last_modified_by_user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), @@ -138,8 +138,8 @@ class Migration(migrations.Migration): name='Order', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('currency', models.CharField(default=b'usd', max_length=8)), - ('status', models.CharField(default=b'cart', max_length=32, choices=[(b'cart', b'cart'), (b'paying', b'paying'), (b'purchased', b'purchased'), (b'refunded', b'refunded'), (b'defunct-cart', b'defunct-cart'), (b'defunct-paying', b'defunct-paying')])), + ('currency', models.CharField(default=u'usd', max_length=8)), + ('status', models.CharField(default=u'cart', max_length=32, choices=[(u'cart', u'cart'), (u'paying', u'paying'), (u'purchased', u'purchased'), (u'refunded', u'refunded'), (u'defunct-cart', u'defunct-cart'), (u'defunct-paying', u'defunct-paying')])), ('purchase_time', models.DateTimeField(null=True, blank=True)), ('refunded_time', models.DateTimeField(null=True, blank=True)), ('bill_to_first', models.CharField(max_length=64, blank=True)), @@ -159,7 +159,7 @@ class Migration(migrations.Migration): ('recipient_name', models.CharField(max_length=255, null=True, blank=True)), ('recipient_email', models.CharField(max_length=255, null=True, blank=True)), ('customer_reference_number', models.CharField(max_length=63, null=True, blank=True)), - ('order_type', models.CharField(default=b'personal', max_length=32, choices=[(b'personal', b'personal'), (b'business', b'business')])), + ('order_type', models.CharField(default=u'personal', max_length=32, choices=[(u'personal', u'personal'), (u'business', u'business')])), ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), @@ -169,16 +169,16 @@ 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)), - ('status', models.CharField(default=b'cart', max_length=32, db_index=True, choices=[(b'cart', b'cart'), (b'paying', b'paying'), (b'purchased', b'purchased'), (b'refunded', b'refunded'), (b'defunct-cart', b'defunct-cart'), (b'defunct-paying', b'defunct-paying')])), + ('status', models.CharField(default=u'cart', max_length=32, db_index=True, choices=[(u'cart', u'cart'), (u'paying', u'paying'), (u'purchased', u'purchased'), (u'refunded', u'refunded'), (u'defunct-cart', u'defunct-cart'), (u'defunct-paying', u'defunct-paying')])), ('qty', models.IntegerField(default=1)), ('unit_cost', models.DecimalField(default=0.0, max_digits=30, decimal_places=2)), ('list_price', models.DecimalField(null=True, max_digits=30, decimal_places=2)), - ('line_desc', models.CharField(default=b'Misc. Item', max_length=1024)), - ('currency', models.CharField(default=b'usd', max_length=8)), + ('line_desc', models.CharField(default=u'Misc. Item', max_length=1024)), + ('currency', models.CharField(default=u'usd', max_length=8)), ('fulfilled_time', models.DateTimeField(null=True, db_index=True)), ('refund_requested_time', models.DateTimeField(null=True, db_index=True)), ('service_fee', models.DecimalField(default=0.0, max_digits=30, decimal_places=2)), - ('report_comments', models.TextField(default=b'')), + ('report_comments', models.TextField(default=u'')), ], ), migrations.CreateModel( @@ -231,7 +231,7 @@ class Migration(migrations.Migration): name='Donation', fields=[ ('orderitem_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='shoppingcart.OrderItem', on_delete=models.CASCADE)), - ('donation_type', models.CharField(default=b'general', max_length=32, choices=[(b'general', b'A general donation'), (b'course', b'A donation to a particular course')])), + ('donation_type', models.CharField(default=u'general', max_length=32, choices=[(u'general', u'A general donation'), (u'course', u'A donation to a particular course')])), ('course_id', CourseKeyField(max_length=255, db_index=True)), ], bases=('shoppingcart.orderitem',), diff --git a/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py b/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py index 6f1a7db3f4..4193192adb 100644 --- a/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py +++ b/lms/djangoapps/shoppingcart/migrations/0003_auto_20151217_0958.py @@ -14,11 +14,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='courseregcodeitem', name='mode', - field=models.SlugField(default=b'honor'), + field=models.SlugField(default=u'honor'), ), migrations.AlterField( model_name='paidcourseregistration', name='mode', - field=models.SlugField(default=b'honor'), + field=models.SlugField(default=u'honor'), ), ] diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index f49c9ff728..e019173a06 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -61,32 +61,32 @@ log = logging.getLogger("shoppingcart") ORDER_STATUSES = ( # The user is selecting what he/she wants to purchase. - ('cart', 'cart'), + (u'cart', u'cart'), # The user has been sent to the external payment processor. # At this point, the order should NOT be modified. # If the user returns to the payment flow, he/she will start a new order. - ('paying', 'paying'), + (u'paying', u'paying'), # The user has successfully purchased the items in the order. - ('purchased', 'purchased'), + (u'purchased', u'purchased'), # The user's order has been refunded. - ('refunded', 'refunded'), + (u'refunded', u'refunded'), # The user's order went through, but the order was erroneously left # in 'cart'. - ('defunct-cart', 'defunct-cart'), + (u'defunct-cart', u'defunct-cart'), # The user's order went through, but the order was erroneously left # in 'paying'. - ('defunct-paying', 'defunct-paying'), + (u'defunct-paying', u'defunct-paying'), ) # maps order statuses to their defunct states ORDER_STATUS_MAP = { - 'cart': 'defunct-cart', - 'paying': 'defunct-paying', + u'cart': u'defunct-cart', + u'paying': u'defunct-paying', } # we need a tuple to represent the primary key of various OrderItem subclasses @@ -97,12 +97,12 @@ class OrderTypes(object): """ This class specify purchase OrderTypes. """ - PERSONAL = 'personal' - BUSINESS = 'business' + PERSONAL = u'personal' + BUSINESS = u'business' ORDER_TYPES = ( - (PERSONAL, 'personal'), - (BUSINESS, 'business'), + (PERSONAL, u'personal'), + (BUSINESS, u'business'), ) @@ -120,8 +120,8 @@ class Order(models.Model): app_label = "shoppingcart" user = models.ForeignKey(User, db_index=True, on_delete=models.CASCADE) - currency = models.CharField(default="usd", max_length=8) # lower case ISO currency codes - status = models.CharField(max_length=32, default='cart', choices=ORDER_STATUSES) + currency = models.CharField(default=u"usd", max_length=8) # lower case ISO currency codes + status = models.CharField(max_length=32, default=u'cart', choices=ORDER_STATUSES) purchase_time = models.DateTimeField(null=True, blank=True) refunded_time = models.DateTimeField(null=True, blank=True) # Now we store data needed to generate a reasonable receipt @@ -146,7 +146,7 @@ class Order(models.Model): recipient_name = models.CharField(max_length=255, null=True, blank=True) recipient_email = models.CharField(max_length=255, null=True, blank=True) customer_reference_number = models.CharField(max_length=63, null=True, blank=True) - order_type = models.CharField(max_length=32, default='personal', choices=OrderTypes.ORDER_TYPES) + order_type = models.CharField(max_length=32, default=u'personal', choices=OrderTypes.ORDER_TYPES) @classmethod def get_cart_for_user(cls, user): @@ -617,17 +617,17 @@ class OrderItem(TimeStampedModel): # this is denormalized, but convenient for SQL queries for reports, etc. user should always be = order.user user = models.ForeignKey(User, db_index=True, on_delete=models.CASCADE) # this is denormalized, but convenient for SQL queries for reports, etc. status should always be = order.status - status = models.CharField(max_length=32, default='cart', choices=ORDER_STATUSES, db_index=True) + status = models.CharField(max_length=32, default=u'cart', choices=ORDER_STATUSES, db_index=True) qty = models.IntegerField(default=1) unit_cost = models.DecimalField(default=0.0, decimal_places=2, max_digits=30) list_price = models.DecimalField(decimal_places=2, max_digits=30, null=True) - line_desc = models.CharField(default="Misc. Item", max_length=1024) - currency = models.CharField(default="usd", max_length=8) # lower case ISO currency codes + line_desc = models.CharField(default=u"Misc. Item", max_length=1024) + currency = models.CharField(default=u"usd", max_length=8) # lower case ISO currency codes fulfilled_time = models.DateTimeField(null=True, db_index=True) refund_requested_time = models.DateTimeField(null=True, db_index=True) service_fee = models.DecimalField(default=0.0, decimal_places=2, max_digits=30) # general purpose field, not user-visible. Used for reporting - report_comments = models.TextField(default="") + report_comments = models.TextField(default=u"") @property def line_cost(self): @@ -914,17 +914,17 @@ class Invoice(TimeStampedModel): INVOICE_TRANSACTION_STATUSES = ( # A payment/refund is in process, but money has not yet been transferred - ('started', 'started'), + (u'started', u'started'), # A payment/refund has completed successfully # This should be set ONLY once money has been successfully exchanged. - ('completed', 'completed'), + (u'completed', u'completed'), # A payment/refund was promised, but was cancelled before # money had been transferred. An example would be # cancelling a refund check before the recipient has # a chance to deposit it. - ('cancelled', 'cancelled') + (u'cancelled', u'cancelled') ) @@ -956,7 +956,7 @@ class InvoiceTransaction(TimeStampedModel): ) ) currency = models.CharField( - default="usd", + default=u"usd", max_length=8, help_text=ugettext_lazy("Lower-case ISO currency codes") ) @@ -967,7 +967,7 @@ class InvoiceTransaction(TimeStampedModel): ) status = models.CharField( max_length=32, - default='started', + default=u'started', choices=INVOICE_TRANSACTION_STATUSES, help_text=ugettext_lazy( "The status of the payment or refund. " @@ -1053,7 +1053,7 @@ class InvoiceItem(TimeStampedModel): help_text=ugettext_lazy("The price per item sold, including discounts.") ) currency = models.CharField( - default="usd", + default=u"usd", max_length=8, help_text=ugettext_lazy("Lower-case ISO currency codes") ) @@ -2078,12 +2078,12 @@ class Donation(OrderItem): # Types of donations DONATION_TYPES = ( - ("general", "A general donation"), - ("course", "A donation to a particular course") + (u"general", u"A general donation"), + (u"course", u"A donation to a particular course") ) # The type of donation - donation_type = models.CharField(max_length=32, default="general", choices=DONATION_TYPES) + donation_type = models.CharField(max_length=32, default=u"general", choices=DONATION_TYPES) # If a donation is made for a specific course, then store the course ID here. # If the donation is made to the organization as a whole,