# Generated by Django 4.1.5 on 2023-01-21 20:20 import core.weight from django.conf import settings import django.contrib.postgres.fields import django.core.validators from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import django_measurement.models import measurement.measures.mass class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('accounts', '0001_initial'), ] operations = [ migrations.CreateModel( name='Coupon', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('type', models.CharField(choices=[('entire_order', 'Entire order'), ('shipping', 'Shipping'), ('specific_product', 'Specific products, collections and categories')], default='entire_order', max_length=20)), ('name', models.CharField(blank=True, max_length=255, null=True)), ('code', models.CharField(db_index=True, max_length=12, unique=True)), ('valid_from', models.DateTimeField(default=django.utils.timezone.now)), ('valid_to', models.DateTimeField(blank=True, null=True)), ('discount_value_type', models.CharField(choices=[('fixed', 'USD'), ('percentage', '%')], default='fixed', max_length=10)), ('discount_value', models.DecimalField(decimal_places=2, max_digits=12)), ('users', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL)), ], options={ 'ordering': ['-valid_from', '-valid_to', 'code'], }, ), migrations.CreateModel( name='Order', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('status', models.CharField(choices=[('draft', 'Draft'), ('unfulfilled', 'Unfulfilled'), ('partially_fulfilled', 'Partially fulfilled'), ('partially_returned', 'Partially returned'), ('returned', 'Returned'), ('fulfilled', 'Fulfilled'), ('canceled', 'Canceled')], default='unfulfilled', max_length=32)), ('subtotal_amount', models.DecimalField(decimal_places=2, default=0, max_digits=10)), ('coupon_amount', models.DecimalField(decimal_places=2, default=0, max_digits=10)), ('shipping_total', models.DecimalField(decimal_places=2, default=0, max_digits=5)), ('total_amount', models.DecimalField(decimal_places=2, default=0, max_digits=10)), ('weight', django_measurement.models.MeasurementField(blank=True, default=core.weight.zero_weight, measurement=measurement.measures.mass.Mass, null=True)), ('subscription_description', models.CharField(blank=True, max_length=500)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('billing_address', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='accounts.address')), ('coupon', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to='core.coupon')), ('customer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to=settings.AUTH_USER_MODEL)), ('shipping_address', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='accounts.address')), ], options={ 'ordering': ['-created_at'], 'permissions': [('cancel_order', 'Can cancel order')], }, ), migrations.CreateModel( name='Product', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=250)), ('subtitle', models.CharField(blank=True, max_length=250)), ('description', models.TextField(blank=True)), ('checkout_limit', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)])), ('visible_in_listings', models.BooleanField(default=False)), ('sorting', models.PositiveIntegerField(blank=True, null=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ], options={ 'ordering': ['sorting', 'name'], }, ), migrations.CreateModel( name='ProductCategory', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('main_category', models.BooleanField(default=True)), ], options={ 'verbose_name': 'Product Category', 'verbose_name_plural': 'Product Categories', }, ), migrations.CreateModel( name='ProductPhoto', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('image', models.ImageField(upload_to='products/images')), ('sorting', models.PositiveIntegerField(blank=True, null=True)), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.product')), ], options={ 'ordering': ['sorting'], }, ), migrations.CreateModel( name='ShippingRate', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('shipping_provider', models.CharField(choices=[('USPS', 'USPS')], default='USPS', max_length=255)), ('name', models.CharField(max_length=255)), ('container', models.CharField(choices=[('PRIORITY', (('FLAT RATE ENVELOPE', 'Flat Rate Envelope'), ('LEGAL FLAT RATE ENVELOPE', 'Legal Flat Rate Envelope'), ('PADDED FLAT RATE ENVELOPE', 'Padded Flat Rate Envelope'), ('SM FLAT RATE ENVELOPE', 'Sm Flat Rate Envelope'), ('WINDOW FLAT RATE ENVELOPE', 'Window Flat Rate Envelope'), ('GIFT CARD FLAT RATE ENVELOPE', 'Gift Card Flat Rate Envelope'), ('SM FLAT RATE BOX', 'Sm Flat Rate Box'), ('MD FLAT RATE BOX', 'Md Flat Rate Box'), ('LG FLAT RATE BOX', 'Lg Flat Rate Box'), ('VARIABLE', 'Variable'))), ('PRIORITY COMMERCIAL', (('REGIONALRATEBOXA', 'Regional Rate Box A'), ('REGIONALRATEBOXB', 'Regional Rate Box B')))], default='VARIABLE', max_length=255)), ('min_order_weight', django_measurement.models.MeasurementField(blank=True, default=core.weight.zero_weight, measurement=measurement.measures.mass.Mass, null=True)), ('max_order_weight', django_measurement.models.MeasurementField(blank=True, default=core.weight.zero_weight, measurement=measurement.measures.mass.Mass, null=True)), ('is_selectable', models.BooleanField(default=True)), ], options={ 'ordering': ['min_order_weight'], }, ), migrations.CreateModel( name='Transaction', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('status', models.CharField(blank=True, choices=[('CREATED', 'Created'), ('SAVED', 'Saved'), ('APPROVED', 'Approved'), ('VOIDED', 'Voided'), ('COMPLETED', 'Completed'), ('PAYER_ACTION_REQUIRED', 'Payer action required')], default='CREATED', max_length=32)), ('paypal_id', models.CharField(blank=True, max_length=64)), ('confirmation_email_sent', models.BooleanField(default=False)), ('order', models.OneToOneField(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.order')), ], ), migrations.CreateModel( name='TrackingNumber', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('tracking_id', models.CharField(max_length=256)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('order', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='tracking_numbers', to='core.order')), ], options={ 'verbose_name': 'Tracking Number', 'verbose_name_plural': 'Tracking Numbers', }, ), migrations.CreateModel( name='Subscription', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('stripe_id', models.CharField(blank=True, db_index=True, max_length=255)), ('items', django.contrib.postgres.fields.ArrayField(base_field=models.JSONField(blank=True, null=True), default=list, size=None)), ('metadata', models.JSONField(blank=True, null=True)), ('is_active', models.BooleanField(default=False)), ('total_weight', django_measurement.models.MeasurementField(blank=True, default=core.weight.zero_weight, measurement=measurement.measures.mass.Mass, null=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('customer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='subscriptions', to=settings.AUTH_USER_MODEL)), ('shipping_address', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='accounts.address')), ], ), migrations.CreateModel( name='SiteSettings', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('usps_user_id', models.CharField(max_length=255)), ('free_shipping_min', models.DecimalField(blank=True, decimal_places=2, help_text='Minimum dollar amount in the cart subtotal to qualify for free shipping.', max_digits=12, null=True)), ('max_cart_quantity', models.PositiveIntegerField(blank=True, default=20, help_text='Maximum amount of items allowed in cart.', null=True)), ('max_cart_weight', django_measurement.models.MeasurementField(blank=True, default=core.weight.zero_weight, help_text='Maximum weight allowed for cart.', measurement=measurement.measures.mass.Mass, null=True)), ('default_contact_email', models.CharField(blank=True, max_length=255)), ('order_from_email', models.CharField(blank=True, max_length=255)), ('default_zip_origination', models.CharField(blank=True, default='98368', max_length=5)), ('default_shipping_rate', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.shippingrate')), ], options={ 'verbose_name': 'Site Settings', 'verbose_name_plural': 'Site Settings', }, ), migrations.CreateModel( name='ProductVariant', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('sku', models.CharField(blank=True, max_length=255)), ('price', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)), ('weight', django_measurement.models.MeasurementField(blank=True, default=core.weight.zero_weight, measurement=measurement.measures.mass.Mass, null=True)), ('visible_in_listings', models.BooleanField(default=True)), ('track_inventory', models.BooleanField(default=False)), ('stock', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)])), ('sorting', models.PositiveIntegerField(blank=True, null=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.productphoto')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variants', to='core.product')), ], options={ 'ordering': ['sorting', 'weight'], }, ), migrations.CreateModel( name='ProductOption', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('options', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), size=None)), ('products', models.ManyToManyField(related_name='options', to='core.product')), ], ), migrations.AddField( model_name='product', name='category', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.productcategory'), ), migrations.CreateModel( name='OrderLine', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('quantity', models.IntegerField(validators=[django.core.validators.MinValueValidator(1)])), ('quantity_fulfilled', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)])), ('customer_note', models.TextField(blank=True, default='')), ('currency', models.CharField(default='USD', max_length=3)), ('unit_price', models.DecimalField(decimal_places=2, max_digits=12)), ('order', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='core.order')), ('product', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_lines', to='core.product')), ('variant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='order_lines', to='core.productvariant')), ], ), migrations.AddField( model_name='order', name='subscription', field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to='core.subscription'), ), migrations.AddField( model_name='coupon', name='variants', field=models.ManyToManyField(blank=True, to='core.productvariant'), ), migrations.AddIndex( model_name='subscription', index=models.Index(fields=['stripe_id'], name='core_subscr_stripe__08018b_idx'), ), ]