Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Extend TimePeriodType with week value
IKarbowiake68ad7c6ad53
diff --git a/saleor/core/__init__.py b/saleor/core/__init__.pyindex 18bd352df8..43682af248 100644--- a/saleor/core/__init__.py+++ b/saleor/core/__init__.py@@ -17,7 +17,8 @@ class JobStatus:class TimePeriodType:DAY = "day"+ WEEK = "week"MONTH = "month"YEAR = "year"- CHOICES = [(DAY, "day"), (MONTH, "Month"), (YEAR, "Year")]+ CHOICES = [(DAY, "Day"), (WEEK, "Week"), (MONTH, "Month"), (YEAR, "Year")]diff --git a/saleor/giftcard/migrations/0009_alter_giftcard_expiry_period_type.py b/saleor/giftcard/migrations/0009_alter_giftcard_expiry_period_type.pynew file mode 100644index 0000000000..ab88f247a7--- /dev/null+++ b/saleor/giftcard/migrations/0009_alter_giftcard_expiry_period_type.py@@ -0,0 +1,28 @@+# Generated by Django 3.2.5 on 2021-08-17 07:42++from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [+ ("giftcard", "0008_alter_giftcardevent_type"),+ ]++ operations = [+ migrations.AlterField(+ model_name="giftcard",+ name="expiry_period_type",+ field=models.CharField(+ blank=True,+ choices=[+ ("day", "Day"),+ ("week", "Week"),+ ("month", "Month"),+ ("year", "Year"),+ ],+ max_length=32,+ null=True,+ ),+ ),+ ]diff --git a/saleor/giftcard/tests/test_utils.py b/saleor/giftcard/tests/test_utils.pyindex 3aebd13692..99e743435f 100644--- a/saleor/giftcard/tests/test_utils.py+++ b/saleor/giftcard/tests/test_utils.py@@ -135,7 +135,7 @@ def test_remove_gift_card_code_from_checkout_no_checkout_gift_cards(@pytest.mark.parametrize(- "period_type, period", [("years", 5), ("months", 13), ("days", 100)]+ "period_type, period", [("years", 5), ("weeks", 1), ("months", 13), ("days", 100)])def test_calculate_expiry_settings(period_type, period, gift_card_expiry_period):# givendiff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex f5f6cc524a..e72828b5bb 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -6532,6 +6532,7 @@ input TimePeriodInputType {enum TimePeriodTypeEnum {DAY+ WEEKMONTHYEAR}diff --git a/saleor/site/migrations/0032_gift_card_settings.py b/saleor/site/migrations/0032_gift_card_settings.pyindex b8edc5a5df..0aa2199153 100644--- a/saleor/site/migrations/0032_gift_card_settings.py+++ b/saleor/site/migrations/0032_gift_card_settings.py@@ -25,7 +25,12 @@ class Migration(migrations.Migration):name="gift_card_expiry_period_type",field=models.CharField(blank=True,- choices=[("day", "day"), ("month", "Month"), ("year", "Year")],+ choices=[+ ("day", "Day"),+ ("week", "Week"),+ ("month", "Month"),+ ("year", "Year"),+ ],max_length=32,null=True,),