Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix max_length for voucher_code in Checkout model. (#9791)

SzymJ0df7b448ef7c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 269900f280..864b38dcb0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,8 @@ All notable, unreleased changes to this project will be documented in this file.
- Changed the order line `id` from `int` to `UUID`, the old ids still can be used
for old order lines.
- Fix invalid `ADDED_PRODUCTS` event parameter for `OrderLinesCreate` mutation - #9653 by @IKarbowiak
-- Fix sorting by publication date with pagination - #9741 by IKarbowiak
+- Fix sorting by publication date with pagination - #9741 by @IKarbowiak
+- Fix max_length for voucher_code in Checkout model - #9791 by @SzymJ
### Other changes
- Fix for sending incorrect prices to Avatax - #9633 by @korycins
diff --git a/saleor/checkout/migrations/0043_alter_checkout_voucher_code.py b/saleor/checkout/migrations/0043_alter_checkout_voucher_code.py
new file mode 100644
index 0000000000..26ba1c1838
--- /dev/null
+++ b/saleor/checkout/migrations/0043_alter_checkout_voucher_code.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.13 on 2022-05-18 10:09
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("checkout", "0042_rename_created_checkout_created_at"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="checkout",
+ name="voucher_code",
+ field=models.CharField(blank=True, max_length=255, null=True),
+ ),
+ ]
diff --git a/saleor/checkout/migrations/0047_merge_20220519_1029.py b/saleor/checkout/migrations/0047_merge_20220519_1029.py
new file mode 100644
index 0000000000..1004aac10d
--- /dev/null
+++ b/saleor/checkout/migrations/0047_merge_20220519_1029.py
@@ -0,0 +1,13 @@
+# Generated by Django 3.2.13 on 2022-05-19 10:29
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("checkout", "0043_alter_checkout_voucher_code"),
+ ("checkout", "0046_alter_checkout_line_pk"),
+ ]
+
+ operations = []
diff --git a/saleor/checkout/models.py b/saleor/checkout/models.py
index 7ed17ac44f..dd500f42de 100644
--- a/saleor/checkout/models.py
+++ b/saleor/checkout/models.py
@@ -97,7 +97,7 @@ class Checkout(ModelWithMetadata):
discount_name = models.CharField(max_length=255, blank=True, null=True)
translated_discount_name = models.CharField(max_length=255, blank=True, null=True)
- voucher_code = models.CharField(max_length=12, blank=True, null=True)
+ voucher_code = models.CharField(max_length=255, blank=True, null=True)
gift_cards = models.ManyToManyField(GiftCard, blank=True, related_name="checkouts")
redirect_url = models.URLField(blank=True, null=True)