Merge branch 'feature/order-migration' into develop

This commit is contained in:
Nathan Chapman 2022-04-30 17:27:16 -06:00
commit 0c7020b42c
2 changed files with 34 additions and 4 deletions

View File

@ -0,0 +1,27 @@
# Generated by Django 4.0.2 on 2022-04-30 23:11
import core.weight
from django.db import migrations, models
import django.db.models.deletion
import django_measurement.models
import measurement.measures.mass
class Migration(migrations.Migration):
dependencies = [
('core', '0007_product_subtitle'),
]
operations = [
migrations.AlterField(
model_name='order',
name='coupon',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to='core.coupon'),
),
migrations.AlterField(
model_name='order',
name='weight',
field=django_measurement.models.MeasurementField(blank=True, default=core.weight.zero_weight, measurement=measurement.measures.mass.Mass, null=True),
),
]

View File

@ -190,21 +190,21 @@ class Order(models.Model):
related_name="+", related_name="+",
editable=False, editable=False,
null=True, null=True,
on_delete=models.SET_NULL, on_delete=models.SET_NULL
) )
shipping_address = models.ForeignKey( shipping_address = models.ForeignKey(
Address, Address,
related_name="+", related_name="+",
editable=False, editable=False,
null=True, null=True,
on_delete=models.SET_NULL, on_delete=models.SET_NULL
) )
shipping_method = models.ForeignKey( shipping_method = models.ForeignKey(
ShippingMethod, ShippingMethod,
blank=True, blank=True,
null=True, null=True,
related_name="orders", related_name="orders",
on_delete=models.SET_NULL, on_delete=models.SET_NULL
) )
@ -212,6 +212,7 @@ class Order(models.Model):
Coupon, Coupon,
related_name='orders', related_name='orders',
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
blank=True,
null=True null=True
) )
@ -224,7 +225,7 @@ class Order(models.Model):
total_net_amount = models.DecimalField( total_net_amount = models.DecimalField(
max_digits=10, max_digits=10,
decimal_places=2, decimal_places=2,
default=0, default=0
) )
@ -232,6 +233,8 @@ class Order(models.Model):
measurement=Weight, measurement=Weight,
unit_choices=WeightUnits.CHOICES, unit_choices=WeightUnits.CHOICES,
default=zero_weight, default=zero_weight,
blank=True,
null=True
) )
created_at = models.DateTimeField(auto_now_add=True, editable=False) created_at = models.DateTimeField(auto_now_add=True, editable=False)