From 8393a50209355c49d997c69e967fed7b6a81ce29 Mon Sep 17 00:00:00 2001 From: John Carter Date: Wed, 14 Nov 2018 19:01:21 +1300 Subject: [PATCH] Allow Product.attributes and .url to be blank They're not required if type="service" --- djstripe/migrations/0001_initial.py | 4 ++-- djstripe/models/core.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/djstripe/migrations/0001_initial.py b/djstripe/migrations/0001_initial.py index c9f7726033..73469be7aa 100644 --- a/djstripe/migrations/0001_initial.py +++ b/djstripe/migrations/0001_initial.py @@ -448,13 +448,13 @@ class Migration(migrations.Migration): ('name', models.CharField(help_text="The product's name, meant to be displayable to the customer. Applicable to both `service` and `good` types.", max_length=5000)), ('type', djstripe.fields.StripeEnumField(enum=djstripe.enums.ProductType, help_text='The type of the product. The product is either of type `good`, which is eligible for use with Orders and SKUs, or `service`, which is eligible for use with Subscriptions and Plans.', max_length=7)), ('active', models.NullBooleanField(help_text='Whether the product is currently available for purchase. Only applicable to products of `type=good`.')), - ('attributes', djstripe.fields.JSONField(help_text='A list of up to 5 attributes that each SKU can provide values for (e.g., `["color", "size"]`). Only applicable to products of `type=good`.', null=True)), + ('attributes', djstripe.fields.JSONField(help_text='A list of up to 5 attributes that each SKU can provide values for (e.g., `["color", "size"]`). Only applicable to products of `type=good`.', null=True, blank=True)), ('caption', models.CharField(help_text='A short one-line description of the product, meant to be displayableto the customer. Only applicable to products of `type=good`.', max_length=5000, null=True, blank=True)), ('deactivate_on', djstripe.fields.JSONField(blank=True, help_text='An array of connect application identifiers that cannot purchase this product. Only applicable to products of `type=good`.')), ('images', djstripe.fields.JSONField(blank=True, help_text='A list of up to 8 URLs of images for this product, meant to be displayable to the customer. Only applicable to products of `type=good`.')), ('package_dimensions', djstripe.fields.JSONField(help_text='The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own `package_dimensions`. Only applicable to products of `type=good`.', null=True, blank=True)), ('shippable', models.NullBooleanField(help_text='Whether this product is a shipped good. Only applicable to products of `type=good`.')), - ('url', models.CharField(help_text='A URL of a publicly-accessible webpage for this product. Only applicable to products of `type=good`.', max_length=799, null=True)), + ('url', models.CharField(help_text='A URL of a publicly-accessible webpage for this product. Only applicable to products of `type=good`.', max_length=799, null=True, blank=True)), ('statement_descriptor', models.CharField(help_text="Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used. Only available on products of type=`service`.", max_length=22, null=True, blank=True)), ('unit_label', models.CharField(max_length=12, null=True)), ], diff --git a/djstripe/models/core.py b/djstripe/models/core.py index ba792fb14d..a83352e8cf 100644 --- a/djstripe/models/core.py +++ b/djstripe/models/core.py @@ -1304,7 +1304,7 @@ class Product(StripeModel): ) ) attributes = JSONField( - null=True, + null=True, blank=True, help_text=( "A list of up to 5 attributes that each SKU can provide values for " '(e.g., `["color", "size"]`). Only applicable to products of `type=good`.' @@ -1349,7 +1349,7 @@ class Product(StripeModel): ) url = models.CharField( max_length=799, - null=True, + null=True, blank=True, help_text=( "A URL of a publicly-accessible webpage for this product. " "Only applicable to products of `type=good`."