コード例 #1
0
class Migration(migrations.Migration):

    dependencies = [("product", "0004_merge")]

    operations = [
        migrations.AlterField(
            model_name="fixedproductdiscount",
            name="discount",
            field=django_prices.models.MoneyField(
                verbose_name="discount value",
                max_digits=12,
                decimal_places=2,
                currency=settings.DEFAULT_CURRENCY,
            ),
        ),
        migrations.AlterField(
            model_name="product",
            name="price",
            field=django_prices.models.MoneyField(
                verbose_name="price",
                max_digits=12,
                decimal_places=2,
                currency=settings.DEFAULT_CURRENCY,
            ),
        ),
        migrations.AlterField(
            model_name="product",
            name="weight",
            field=models.DecimalField(verbose_name="weight",
                                      max_digits=6,
                                      decimal_places=2),
        ),
        migrations.AlterField(
            model_name="productvariant",
            name="price_override",
            field=django_prices.models.MoneyField(
                verbose_name="price override",
                decimal_places=2,
                blank=True,
                currency=settings.DEFAULT_CURRENCY,
                max_digits=12,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="productvariant",
            name="weight_override",
            field=models.DecimalField(
                verbose_name="weight override",
                decimal_places=2,
                blank=True,
                max_digits=6,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="stock",
            name="cost_price",
            field=django_prices.models.MoneyField(
                verbose_name="cost price",
                decimal_places=2,
                blank=True,
                currency=settings.DEFAULT_CURRENCY,
                max_digits=12,
                null=True,
            ),
        ),
    ]
コード例 #2
0
class Migration(migrations.Migration):

    dependencies = [
        ("product", "0010_auto_20160129_0826"),
        ("discount", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="Voucher",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "type",
                    models.CharField(
                        choices=[
                            ("product", "Product"),
                            ("category", "Category"),
                            ("shipping", "Shipping"),
                            ("basket", "Baskets over"),
                        ],
                        max_length=20,
                    ),
                ),
                ("name", models.CharField(blank=True,
                                          max_length=255,
                                          null=True)),
                ("code",
                 models.CharField(db_index=True, max_length=12, unique=True)),
                (
                    "usage_limit",
                    models.PositiveIntegerField(blank=True,
                                                help_text="Unlimited if empty",
                                                null=True),
                ),
                ("used", models.PositiveIntegerField(default=0,
                                                     editable=False)),
                ("start_date", models.DateField(default=datetime.date.today)),
                (
                    "end_date",
                    models.DateField(blank=True,
                                     help_text="Never expire if empty",
                                     null=True),
                ),
                (
                    "discount_value_type",
                    models.CharField(
                        choices=[
                            ("fixed", settings.DEFAULT_CURRENCY),
                            ("percentage", "%"),
                        ],
                        default="fixed",
                        max_length=10,
                    ),
                ),
                (
                    "discount_value",
                    models.DecimalField(decimal_places=2, max_digits=12),
                ),
                ("apply_to",
                 models.CharField(blank=True, max_length=20, null=True)),
                (
                    "limit",
                    django_prices.models.MoneyField(
                        blank=True,
                        currency=settings.DEFAULT_CURRENCY,
                        decimal_places=2,
                        max_digits=12,
                        null=True,
                    ),
                ),
                (
                    "category",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="product.Category",
                    ),
                ),
                (
                    "product",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="product.Product",
                    ),
                ),
            ],
        )
    ]
コード例 #3
0
class Migration(migrations.Migration):

    dependencies = [("discount", "0003_auto_20160207_0534")]

    operations = [
        migrations.AlterModelOptions(
            name="sale",
            options={"verbose_name": "sale", "verbose_name_plural": "sales"},
        ),
        migrations.AlterModelOptions(
            name="voucher",
            options={"verbose_name": "voucher", "verbose_name_plural": "vouchers"},
        ),
        migrations.AlterField(
            model_name="sale",
            name="categories",
            field=models.ManyToManyField(
                blank=True, to="product.Category", verbose_name="categories"
            ),
        ),
        migrations.AlterField(
            model_name="sale",
            name="name",
            field=models.CharField(max_length=255, verbose_name="name"),
        ),
        migrations.AlterField(
            model_name="sale",
            name="products",
            field=models.ManyToManyField(
                blank=True, to="product.Product", verbose_name="products"
            ),
        ),
        migrations.AlterField(
            model_name="sale",
            name="type",
            field=models.CharField(
                choices=[("fixed", settings.DEFAULT_CURRENCY), ("percentage", "%")],
                default="fixed",
                max_length=10,
                verbose_name="type",
            ),
        ),
        migrations.AlterField(
            model_name="sale",
            name="value",
            field=models.DecimalField(
                decimal_places=2, default=0, max_digits=12, verbose_name="value"
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="apply_to",
            field=models.CharField(
                blank=True, max_length=20, null=True, verbose_name="apply to"
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="category",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="product.Category",
                verbose_name="category",
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="limit",
            field=django_prices.models.MoneyField(
                blank=True,
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                max_digits=12,
                null=True,
                verbose_name="limit",
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="product",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="product.Product",
                verbose_name="product",
            ),
        ),
    ]
コード例 #4
0
class Migration(migrations.Migration):

    dependencies = [("order", "0026_auto_20171218_0428")]

    operations = [
        migrations.AlterField(
            model_name="deliverygroup",
            name="last_updated",
            field=models.DateTimeField(auto_now=True, null=True),
        ),
        migrations.AlterField(
            model_name="deliverygroup",
            name="shipping_method_name",
            field=models.CharField(blank=True,
                                   default=None,
                                   editable=False,
                                   max_length=255,
                                   null=True),
        ),
        migrations.AlterField(
            model_name="deliverygroup",
            name="status",
            field=models.CharField(
                choices=[
                    ("new", "Processing"),
                    ("cancelled", "Cancelled"),
                    ("shipped", "Shipped"),
                ],
                default="new",
                max_length=32,
            ),
        ),
        migrations.AlterField(
            model_name="deliverygroup",
            name="tracking_number",
            field=models.CharField(blank=True, default="", max_length=255),
        ),
        migrations.AlterField(
            model_name="order",
            name="billing_address",
            field=models.ForeignKey(
                editable=False,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="+",
                to="account.Address",
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="created",
            field=models.DateTimeField(default=django.utils.timezone.now,
                                       editable=False),
        ),
        migrations.AlterField(
            model_name="order",
            name="discount_amount",
            field=django_prices.models.MoneyField(
                blank=True,
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                max_digits=12,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="discount_name",
            field=models.CharField(blank=True, default="", max_length=255),
        ),
        migrations.AlterField(
            model_name="order",
            name="last_status_change",
            field=models.DateTimeField(default=django.utils.timezone.now,
                                       editable=False),
        ),
        migrations.AlterField(
            model_name="order",
            name="shipping_address",
            field=models.ForeignKey(
                editable=False,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="+",
                to="account.Address",
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="shipping_price",
            field=django_prices.models.MoneyField(
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=4,
                default=0,
                editable=False,
                max_digits=12,
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="token",
            field=models.CharField(max_length=36, unique=True),
        ),
        migrations.AlterField(
            model_name="order",
            name="total_net",
            field=django_prices.models.MoneyField(
                blank=True,
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                max_digits=12,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="total_tax",
            field=django_prices.models.MoneyField(
                blank=True,
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                max_digits=12,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="tracking_client_id",
            field=models.CharField(blank=True, editable=False, max_length=36),
        ),
        migrations.AlterField(
            model_name="order",
            name="user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="orders",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="user_email",
            field=models.EmailField(blank=True,
                                    default="",
                                    editable=False,
                                    max_length=254),
        ),
        migrations.AlterField(
            model_name="order",
            name="voucher",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="discount.Voucher",
            ),
        ),
        migrations.AlterField(
            model_name="orderhistoryentry",
            name="comment",
            field=models.CharField(blank=True, default="", max_length=100),
        ),
        migrations.AlterField(
            model_name="orderhistoryentry",
            name="date",
            field=models.DateTimeField(default=django.utils.timezone.now,
                                       editable=False),
        ),
        migrations.AlterField(
            model_name="orderhistoryentry",
            name="order",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="history",
                to="order.Order",
            ),
        ),
        migrations.AlterField(
            model_name="orderhistoryentry",
            name="status",
            field=models.CharField(choices=[("open", "Open"),
                                            ("closed", "Closed")],
                                   max_length=32),
        ),
        migrations.AlterField(
            model_name="orderhistoryentry",
            name="user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="delivery_group",
            field=models.ForeignKey(
                editable=False,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="lines",
                to="order.DeliveryGroup",
            ),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="product",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to="product.Product",
            ),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="product_name",
            field=models.CharField(max_length=128),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="product_sku",
            field=models.CharField(max_length=32),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="quantity",
            field=models.IntegerField(validators=[
                django.core.validators.MinValueValidator(0),
                django.core.validators.MaxValueValidator(999),
            ]),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="stock",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="product.Stock",
            ),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="stock_location",
            field=models.CharField(default="", max_length=100),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="unit_price_gross",
            field=models.DecimalField(decimal_places=4, max_digits=12),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="unit_price_net",
            field=models.DecimalField(decimal_places=4, max_digits=12),
        ),
        migrations.AlterField(
            model_name="ordernote",
            name="content",
            field=models.CharField(max_length=250),
        ),
        migrations.AlterField(
            model_name="payment",
            name="order",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="payments",
                to="order.Order",
            ),
        ),
    ]
コード例 #5
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("product", "0001_initial"),
        ("account", "__first__"),
    ]

    operations = [
        migrations.CreateModel(
            name="DeliveryGroup",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        default="new",
                        max_length=32,
                        verbose_name="delivery status",
                        choices=[
                            ("new", "Processing"),
                            ("cancelled", "Cancelled"),
                            ("shipped", "Shipped"),
                        ],
                    ),
                ),
                (
                    "shipping_required",
                    models.BooleanField(default=True,
                                        verbose_name="shipping required"),
                ),
                (
                    "shipping_price",
                    django_prices.models.MoneyField(
                        decimal_places=4,
                        default=0,
                        editable=False,
                        currency=b"USD",
                        max_digits=12,
                        verbose_name="shipping price",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Order",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        default="new",
                        max_length=32,
                        verbose_name="order status",
                        choices=[
                            ("new", "Processing"),
                            ("cancelled", "Cancelled"),
                            ("payment-pending", "Waiting for payment"),
                            ("fully-paid", "Fully paid"),
                            ("shipped", "Shipped"),
                        ],
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        verbose_name="created",
                        editable=False,
                    ),
                ),
                (
                    "last_status_change",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        verbose_name="last status change",
                        editable=False,
                    ),
                ),
                (
                    "tracking_client_id",
                    models.CharField(max_length=36, editable=False,
                                     blank=True),
                ),
                (
                    "shipping_method",
                    models.CharField(max_length=255,
                                     verbose_name="Delivery method",
                                     blank=True),
                ),
                (
                    "anonymous_user_email",
                    models.EmailField(default="",
                                      max_length=254,
                                      editable=False,
                                      blank=True),
                ),
                (
                    "token",
                    models.CharField(unique=True,
                                     max_length=36,
                                     verbose_name="token"),
                ),
                (
                    "billing_address",
                    models.ForeignKey(
                        related_name="+",
                        editable=False,
                        to="account.Address",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
                (
                    "shipping_address",
                    models.ForeignKey(
                        related_name="+",
                        editable=False,
                        to="account.Address",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        related_name="orders",
                        verbose_name="user",
                        blank=True,
                        to=settings.AUTH_USER_MODEL,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
            options={"ordering": ("-last_status_change", )},
        ),
        migrations.CreateModel(
            name="OrderedItem",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "product_name",
                    models.CharField(max_length=128,
                                     verbose_name="product name"),
                ),
                ("product_sku",
                 models.CharField(max_length=32, verbose_name="sku")),
                (
                    "quantity",
                    models.IntegerField(
                        verbose_name="quantity",
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(999),
                        ],
                    ),
                ),
                (
                    "unit_price_net",
                    models.DecimalField(verbose_name="unit price (net)",
                                        max_digits=12,
                                        decimal_places=4),
                ),
                (
                    "unit_price_gross",
                    models.DecimalField(
                        verbose_name="unit price (gross)",
                        max_digits=12,
                        decimal_places=4,
                    ),
                ),
                (
                    "delivery_group",
                    models.ForeignKey(
                        related_name="items",
                        editable=False,
                        to="order.DeliveryGroup",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
                (
                    "product",
                    models.ForeignKey(
                        related_name="+",
                        on_delete=django.db.models.deletion.SET_NULL,
                        verbose_name="product",
                        blank=True,
                        to="product.Product",
                        null=True,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="OrderHistoryEntry",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "date",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        verbose_name="last history change",
                        editable=False,
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        max_length=32,
                        verbose_name="order status",
                        choices=[
                            ("new", "Processing"),
                            ("cancelled", "Cancelled"),
                            ("payment-pending", "Waiting for payment"),
                            ("fully-paid", "Fully paid"),
                            ("shipped", "Shipped"),
                        ],
                    ),
                ),
                ("comment",
                 models.CharField(default="", max_length=100, blank=True)),
                (
                    "order",
                    models.ForeignKey(
                        related_name="history",
                        to="order.Order",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        blank=True,
                        to=settings.AUTH_USER_MODEL,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
            options={"ordering": ["date"]},
        ),
        migrations.CreateModel(
            name="OrderNote",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("date", models.DateTimeField(auto_now_add=True)),
                ("content", models.CharField(max_length=250)),
                (
                    "order",
                    models.ForeignKey(
                        related_name="notes",
                        to="order.Order",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        to=settings.AUTH_USER_MODEL,
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Payment",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("variant", models.CharField(max_length=255)),
                (
                    "status",
                    models.CharField(
                        default="waiting",
                        max_length=10,
                        choices=[
                            ("waiting", "Waiting for confirmation"),
                            ("preauth", "Pre-authorized"),
                            ("confirmed", "Confirmed"),
                            ("rejected", "Rejected"),
                            ("refunded", "Refunded"),
                            ("error", "Error"),
                            ("input", "Input"),
                        ],
                    ),
                ),
                (
                    "fraud_status",
                    models.CharField(
                        default="unknown",
                        max_length=10,
                        verbose_name="fraud check",
                        choices=[
                            ("unknown", "Unknown"),
                            ("accept", "Passed"),
                            ("reject", "Rejected"),
                            ("review", "Review"),
                        ],
                    ),
                ),
                ("fraud_message", models.TextField(default="", blank=True)),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                ("transaction_id", models.CharField(max_length=255,
                                                    blank=True)),
                ("currency", models.CharField(max_length=10)),
                (
                    "total",
                    models.DecimalField(default="0.0",
                                        max_digits=9,
                                        decimal_places=2),
                ),
                (
                    "delivery",
                    models.DecimalField(default="0.0",
                                        max_digits=9,
                                        decimal_places=2),
                ),
                (
                    "tax",
                    models.DecimalField(default="0.0",
                                        max_digits=9,
                                        decimal_places=2),
                ),
                ("description", models.TextField(default="", blank=True)),
                ("billing_first_name",
                 models.CharField(max_length=256, blank=True)),
                ("billing_last_name",
                 models.CharField(max_length=256, blank=True)),
                ("billing_address_1",
                 models.CharField(max_length=256, blank=True)),
                ("billing_address_2",
                 models.CharField(max_length=256, blank=True)),
                ("billing_city", models.CharField(max_length=256, blank=True)),
                ("billing_postcode",
                 models.CharField(max_length=256, blank=True)),
                ("billing_country_code",
                 models.CharField(max_length=2, blank=True)),
                ("billing_country_area",
                 models.CharField(max_length=256, blank=True)),
                ("billing_email", models.EmailField(max_length=254,
                                                    blank=True)),
                ("customer_ip_address", models.IPAddressField(blank=True)),
                ("extra_data", models.TextField(default="", blank=True)),
                ("message", models.TextField(default="", blank=True)),
                ("token",
                 models.CharField(default="", max_length=36, blank=True)),
                (
                    "captured_amount",
                    models.DecimalField(default="0.0",
                                        max_digits=9,
                                        decimal_places=2),
                ),
                (
                    "order",
                    models.ForeignKey(
                        related_name="payments",
                        to="order.Order",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.AddField(
            model_name="deliverygroup",
            name="order",
            field=models.ForeignKey(
                related_name="groups",
                editable=False,
                to="order.Order",
                on_delete=django.db.models.deletion.CASCADE,
            ),
        ),
    ]
コード例 #6
0
class Migration(migrations.Migration):

    dependencies = [
        ("order", "0064_auto_20181016_0819"),
        ("payment", "0002_transfer_payment_to_payment_method"),
    ]

    operations = [
        migrations.AlterField(
            model_name="order",
            name="discount_amount",
            field=django_prices.models.MoneyField(
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                default=app.core.taxes.zero_money,
                max_digits=12,
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="total_gross",
            field=django_prices.models.MoneyField(
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                default=app.core.taxes.zero_money,
                max_digits=12,
            ),
        ),
        migrations.AlterField(
            model_name="order",
            name="total_net",
            field=django_prices.models.MoneyField(
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                default=app.core.taxes.zero_money,
                max_digits=12,
            ),
        ),
        migrations.RemoveField(model_name="payment", name="order"),
        migrations.DeleteModel(name="Payment"),
        migrations.AlterField(
            model_name="orderevent",
            name="type",
            field=models.CharField(
                choices=[
                    ("PLACED", "placed"),
                    ("PLACED_FROM_DRAFT", "draft_placed"),
                    ("OVERSOLD_ITEMS", "oversold_items"),
                    ("ORDER_MARKED_AS_PAID", "marked_as_paid"),
                    ("CANCELED", "canceled"),
                    ("ORDER_FULLY_PAID", "order_paid"),
                    ("UPDATED", "updated"),
                    ("EMAIL_SENT", "email_sent"),
                    ("PAYMENT_CAPTURED", "captured"),
                    ("PAYMENT_REFUNDED", "refunded"),
                    ("PAYMENT_VOIDED", "voided"),
                    ("FULFILLMENT_CANCELED", "fulfillment_canceled"),
                    ("FULFILLMENT_RESTOCKED_ITEMS", "restocked_items"),
                    ("FULFILLMENT_FULFILLED_ITEMS", "fulfilled_items"),
                    ("TRACKING_UPDATED", "tracking_updated"),
                    ("NOTE_ADDED", "note_added"),
                    ("OTHER", "other"),
                ],
                max_length=255,
            ),
        ),
        migrations.AlterField(
            model_name="orderline",
            name="tax_rate",
            field=models.DecimalField(decimal_places=2,
                                      default=Decimal("0.0"),
                                      max_digits=5),
        ),
    ]
コード例 #7
0
ファイル: 0001_initial.py プロジェクト: tobby2002/byai_freq
class Migration(migrations.Migration):

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AttributeChoiceValue",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "display",
                    models.CharField(max_length=100, verbose_name="display name"),
                ),
                (
                    "color",
                    models.CharField(
                        blank=True,
                        max_length=7,
                        verbose_name="color",
                        validators=[
                            django.core.validators.RegexValidator(
                                "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
                            )
                        ],
                    ),
                ),
                (
                    "image",
                    versatileimagefield.fields.VersatileImageField(
                        upload_to="attributes",
                        null=True,
                        verbose_name="image",
                        blank=True,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Category",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("name", models.CharField(max_length=128, verbose_name="name")),
                ("slug", models.SlugField(verbose_name="slug")),
                (
                    "description",
                    models.TextField(verbose_name="description", blank=True),
                ),
                ("hidden", models.BooleanField(default=False, verbose_name="hidden")),
                ("lft", models.PositiveIntegerField(editable=False, db_index=True)),
                ("rght", models.PositiveIntegerField(editable=False, db_index=True)),
                ("tree_id", models.PositiveIntegerField(editable=False, db_index=True)),
                ("level", models.PositiveIntegerField(editable=False, db_index=True)),
                (
                    "parent",
                    models.ForeignKey(
                        related_name="children",
                        verbose_name="parent",
                        blank=True,
                        to="product.Category",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
            options={"verbose_name_plural": "categories"},
        ),
        migrations.CreateModel(
            name="FixedProductDiscount",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("name", models.CharField(max_length=255)),
                (
                    "discount",
                    django_prices.models.MoneyField(
                        currency=settings.DEFAULT_CURRENCY,
                        verbose_name="discount value",
                        max_digits=12,
                        decimal_places=2,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Product",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("name", models.CharField(max_length=128, verbose_name="name")),
                ("description", models.TextField(verbose_name="description")),
                (
                    "price",
                    django_prices.models.MoneyField(
                        currency=settings.DEFAULT_CURRENCY,
                        verbose_name="price",
                        max_digits=12,
                        decimal_places=2,
                    ),
                ),
                (
                    "weight",
                    models.DecimalField(
                        verbose_name="weight", max_digits=6, decimal_places=2
                    ),
                ),
                (
                    "available_on",
                    models.DateField(
                        null=True, verbose_name="available on", blank=True
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="ProductAttribute",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("name", models.SlugField(unique=True, verbose_name="internal name")),
                (
                    "display",
                    models.CharField(max_length=100, verbose_name="display name"),
                ),
            ],
            options={"ordering": ["name"]},
        ),
        migrations.CreateModel(
            name="ProductImage",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "image",
                    versatileimagefield.fields.VersatileImageField(
                        upload_to="products"
                    ),
                ),
                (
                    "ppoi",
                    versatileimagefield.fields.PPOIField(
                        default="0.5x0.5", max_length=20, editable=False
                    ),
                ),
                (
                    "alt",
                    models.CharField(
                        max_length=128, verbose_name="short description", blank=True
                    ),
                ),
                ("order", models.PositiveIntegerField(editable=False)),
                (
                    "product",
                    models.ForeignKey(
                        related_name="images",
                        to="product.Product",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
            options={"ordering": ["order"]},
        ),
        migrations.CreateModel(
            name="ProductVariant",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "sku",
                    models.CharField(unique=True, max_length=32, verbose_name="SKU"),
                ),
                (
                    "name",
                    models.CharField(
                        max_length=100, verbose_name="variant name", blank=True
                    ),
                ),
                (
                    "price_override",
                    django_prices.models.MoneyField(
                        decimal_places=2,
                        currency=settings.DEFAULT_CURRENCY,
                        max_digits=12,
                        blank=True,
                        null=True,
                        verbose_name="price override",
                    ),
                ),
                (
                    "weight_override",
                    models.DecimalField(
                        decimal_places=2,
                        max_digits=6,
                        blank=True,
                        null=True,
                        verbose_name="weight override",
                    ),
                ),
                (
                    "attributes",
                    models.TextField(default="{}", verbose_name="attributes"),
                ),
                (
                    "product",
                    models.ForeignKey(
                        related_name="variants",
                        to="product.Product",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Stock",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("location", models.CharField(max_length=100, verbose_name="location")),
                (
                    "quantity",
                    models.IntegerField(
                        default=Decimal("1"),
                        verbose_name="quantity",
                        validators=[django.core.validators.MinValueValidator(0)],
                    ),
                ),
                (
                    "cost_price",
                    django_prices.models.MoneyField(
                        decimal_places=2,
                        currency=settings.DEFAULT_CURRENCY,
                        max_digits=12,
                        blank=True,
                        null=True,
                        verbose_name="cost price",
                    ),
                ),
                (
                    "variant",
                    models.ForeignKey(
                        related_name="stock",
                        verbose_name="variant",
                        to="product.ProductVariant",
                        on_delete=django.db.models.deletion.CASCADE,
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="product",
            name="attributes",
            field=models.ManyToManyField(
                related_name="products",
                null=True,
                to="product.ProductAttribute",
                blank=True,
            ),
        ),
        migrations.AddField(
            model_name="product",
            name="categories",
            field=models.ManyToManyField(
                related_name="products",
                verbose_name="categories",
                to="product.Category",
            ),
        ),
        migrations.AddField(
            model_name="fixedproductdiscount",
            name="products",
            field=models.ManyToManyField(to="product.Product", blank=True),
        ),
        migrations.AddField(
            model_name="attributechoicevalue",
            name="attribute",
            field=models.ForeignKey(
                related_name="values",
                to="product.ProductAttribute",
                on_delete=django.db.models.deletion.CASCADE,
            ),
        ),
        migrations.AlterUniqueTogether(
            name="stock", unique_together=set([("variant", "location")])
        ),
    ]
コード例 #8
0
class Migration(migrations.Migration):

    dependencies = [("discount", "0006_auto_20171129_1004")]

    operations = [
        migrations.AlterField(
            model_name="sale",
            name="categories",
            field=models.ManyToManyField(blank=True, to="product.Category"),
        ),
        migrations.AlterField(model_name="sale",
                              name="name",
                              field=models.CharField(max_length=255)),
        migrations.AlterField(
            model_name="sale",
            name="products",
            field=models.ManyToManyField(blank=True, to="product.Product"),
        ),
        migrations.AlterField(
            model_name="sale",
            name="type",
            field=models.CharField(
                choices=[("fixed", settings.DEFAULT_CURRENCY),
                         ("percentage", "%")],
                default="fixed",
                max_length=10,
            ),
        ),
        migrations.AlterField(
            model_name="sale",
            name="value",
            field=models.DecimalField(decimal_places=2,
                                      default=0,
                                      max_digits=12),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="apply_to",
            field=models.CharField(blank=True, max_length=20, null=True),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="category",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="product.Category",
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="code",
            field=models.CharField(db_index=True, max_length=12, unique=True),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="discount_value",
            field=models.DecimalField(decimal_places=2, max_digits=12),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="discount_value_type",
            field=models.CharField(
                choices=[("fixed", settings.DEFAULT_CURRENCY),
                         ("percentage", "%")],
                default="fixed",
                max_length=10,
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="end_date",
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="limit",
            field=django_prices.models.MoneyField(
                blank=True,
                currency=settings.DEFAULT_CURRENCY,
                decimal_places=2,
                max_digits=12,
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="name",
            field=models.CharField(blank=True, max_length=255, null=True),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="product",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="product.Product",
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="start_date",
            field=models.DateField(default=datetime.date.today),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="type",
            field=models.CharField(
                choices=[
                    ("value", "All purchases"),
                    ("product", "One product"),
                    ("category", "A category of products"),
                    ("shipping", "Shipping"),
                ],
                default="value",
                max_length=20,
            ),
        ),
        migrations.AlterField(
            model_name="voucher",
            name="usage_limit",
            field=models.PositiveIntegerField(blank=True, null=True),
        ),
    ]