From 056006332639a94b2583877e6fc047349d76cb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Thu, 7 May 2020 12:08:18 +0200 Subject: [PATCH] Add description field to Orders --- .../migrations/0010_order_description.py | 19 +++++++++++++++++++ .../uncloud/uncloud_pay/models.py | 1 + .../uncloud/uncloud_pay/serializers.py | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 uncloud_django_based/uncloud/uncloud_pay/migrations/0010_order_description.py diff --git a/uncloud_django_based/uncloud/uncloud_pay/migrations/0010_order_description.py b/uncloud_django_based/uncloud/uncloud_pay/migrations/0010_order_description.py new file mode 100644 index 0000000..2613bff --- /dev/null +++ b/uncloud_django_based/uncloud/uncloud_pay/migrations/0010_order_description.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.6 on 2020-05-07 10:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('uncloud_pay', '0009_auto_20200502_2047'), + ] + + operations = [ + migrations.AddField( + model_name='order', + name='description', + field=models.TextField(default=''), + preserve_default=False, + ), + ] diff --git a/uncloud_django_based/uncloud/uncloud_pay/models.py b/uncloud_django_based/uncloud/uncloud_pay/models.py index aca226e..1294a54 100644 --- a/uncloud_django_based/uncloud/uncloud_pay/models.py +++ b/uncloud_django_based/uncloud/uncloud_pay/models.py @@ -808,6 +808,7 @@ class Order(models.Model): on_delete=models.CASCADE, editable=False) billing_address = models.ForeignKey(BillingAddress, on_delete=models.CASCADE) + description = models.TextField() # TODO: enforce ending_date - starting_date to be larger than recurring_period. creation_date = models.DateTimeField(auto_now_add=True) diff --git a/uncloud_django_based/uncloud/uncloud_pay/serializers.py b/uncloud_django_based/uncloud/uncloud_pay/serializers.py index 70f5c5e..ad50c68 100644 --- a/uncloud_django_based/uncloud/uncloud_pay/serializers.py +++ b/uncloud_django_based/uncloud/uncloud_pay/serializers.py @@ -70,7 +70,7 @@ class OrderSerializer(serializers.ModelSerializer): class Meta: model = Order - fields = ['uuid', 'owner', 'creation_date', 'starting_date', 'ending_date', + fields = ['uuid', 'owner', 'description', 'creation_date', 'starting_date', 'ending_date', 'bill', 'recurring_period', 'recurring_price', 'one_time_price']