import uuid

from django.db import models
from django.db.models import Sum
from django.conf import settings

from products.models import Product

# Create your models here.


class Order(models.Model):
    full_name = models.CharField(max_length=50, null=False, blank=False)
    email = models.EmailField(max_length=254, null=False, blank=False)
    phone_number = models.CharField(max_length=20, null=False, blank=False)
    country = models.CharField(max_length=40, null=False, blank=False)
    postcode = models.CharField(max_length=20, null=True, blank=True)
    town_or_city = models.CharField(max_length=40, null=False, blank=False)
    street_address1 = models.CharField(max_length=80, null=False, blank=False)
    street_address2 = models.CharField(max_length=80, null=True, blank=True)
    county = models.CharField(max_length=80, null=True, blank=True)
    date = models.DateTimeField(auto_now_add=True)
    delivery_cost = models.DecimalField(max_digits=6, decimal_places=2, null=False, default=0)
    order_total = models.DecimalField(max_digits=10, decimal_places=2, null=False, default=0)
    grand_total = models.DecimalField(max_digits=10, decimal_places=2, null=False, default=0)


def __str__(self):
    return self.full_name



class OrderLineItem(models.Model):
    """ Model for storing each item of the Order """
    order = models.ForeignKey(Order, null=False, blank=False, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, null=False, blank=False, on_delete=models.CASCADE)
    quantity = models.IntegerField(null=False, blank=False, default=0)

    def __str__(self):
        return (order)
d6e0288aa2bbbe76fa32d1f3f7e5ac4b6ea47bac
<mask token>


class OrderLineItem(models.Model):
    """ Model for storing each item of the Order """
    order = models.ForeignKey(Order, null=False, blank=False, on_delete=
        models.CASCADE)
    product = models.ForeignKey(Product, null=False, blank=False, on_delete
        =models.CASCADE)
    quantity = models.IntegerField(null=False, blank=False, default=0)

    def __str__(self):
        return order

<mask token>


class Order(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>


<mask token>


class OrderLineItem(models.Model):
    """ Model for storing each item of the Order """
    order = models.ForeignKey(Order, null=False, blank=False, on_delete=
        models.CASCADE)
    product = models.ForeignKey(Product, null=False, blank=False, on_delete
        =models.CASCADE)
    quantity = models.IntegerField(null=False, blank=False, default=0)

    def __str__(self):
        return order

<mask token>


class Order(models.Model):
    full_name = models.CharField(max_length=50, null=False, blank=False)
    email = models.EmailField(max_length=254, null=False, blank=False)
    phone_number = models.CharField(max_length=20, null=False, blank=False)
    country = models.CharField(max_length=40, null=False, blank=False)
    postcode = models.CharField(max_length=20, null=True, blank=True)
    town_or_city = models.CharField(max_length=40, null=False, blank=False)
    street_address1 = models.CharField(max_length=80, null=False, blank=False)
    street_address2 = models.CharField(max_length=80, null=True, blank=True)
    county = models.CharField(max_length=80, null=True, blank=True)
    date = models.DateTimeField(auto_now_add=True)
    delivery_cost = models.DecimalField(max_digits=6, decimal_places=2,
        null=False, default=0)
    order_total = models.DecimalField(max_digits=10, decimal_places=2, null
        =False, default=0)
    grand_total = models.DecimalField(max_digits=10, decimal_places=2, null
        =False, default=0)


def __str__(self):
    return self.full_name


class OrderLineItem(models.Model):
    """ Model for storing each item of the Order """
    order = models.ForeignKey(Order, null=False, blank=False, on_delete=
        models.CASCADE)
    product = models.ForeignKey(Product, null=False, blank=False, on_delete
        =models.CASCADE)
    quantity = models.IntegerField(null=False, blank=False, default=0)

    def __str__(self):
        return order

import uuid
from django.db import models
from django.db.models import Sum
from django.conf import settings
from products.models import Product


class Order(models.Model):
    full_name = models.CharField(max_length=50, null=False, blank=False)
    email = models.EmailField(max_length=254, null=False, blank=False)
    phone_number = models.CharField(max_length=20, null=False, blank=False)
    country = models.CharField(max_length=40, null=False, blank=False)
    postcode = models.CharField(max_length=20, null=True, blank=True)
    town_or_city = models.CharField(max_length=40, null=False, blank=False)
    street_address1 = models.CharField(max_length=80, null=False, blank=False)
    street_address2 = models.CharField(max_length=80, null=True, blank=True)
    county = models.CharField(max_length=80, null=True, blank=True)
    date = models.DateTimeField(auto_now_add=True)
    delivery_cost = models.DecimalField(max_digits=6, decimal_places=2,
        null=False, default=0)
    order_total = models.DecimalField(max_digits=10, decimal_places=2, null
        =False, default=0)
    grand_total = models.DecimalField(max_digits=10, decimal_places=2, null
        =False, default=0)


def __str__(self):
    return self.full_name


class OrderLineItem(models.Model):
    """ Model for storing each item of the Order """
    order = models.ForeignKey(Order, null=False, blank=False, on_delete=
        models.CASCADE)
    product = models.ForeignKey(Product, null=False, blank=False, on_delete
        =models.CASCADE)
    quantity = models.IntegerField(null=False, blank=False, default=0)

    def __str__(self):
        return order

import uuid

from django.db import models
from django.db.models import Sum
from django.conf import settings

from products.models import Product

# Create your models here.


class Order(models.Model):
    full_name = models.CharField(max_length=50, null=False, blank=False)
    email = models.EmailField(max_length=254, null=False, blank=False)
    phone_number = models.CharField(max_length=20, null=False, blank=False)
    country = models.CharField(max_length=40, null=False, blank=False)
    postcode = models.CharField(max_length=20, null=True, blank=True)
    town_or_city = models.CharField(max_length=40, null=False, blank=False)
    street_address1 = models.CharField(max_length=80, null=False, blank=False)
    street_address2 = models.CharField(max_length=80, null=True, blank=True)
    county = models.CharField(max_length=80, null=True, blank=True)
    date = models.DateTimeField(auto_now_add=True)
    delivery_cost = models.DecimalField(max_digits=6, decimal_places=2, null=False, default=0)
    order_total = models.DecimalField(max_digits=10, decimal_places=2, null=False, default=0)
    grand_total = models.DecimalField(max_digits=10, decimal_places=2, null=False, default=0)


def __str__(self):
    return self.full_name



class OrderLineItem(models.Model):
    """ Model for storing each item of the Order """
    order = models.ForeignKey(Order, null=False, blank=False, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, null=False, blank=False, on_delete=models.CASCADE)
    quantity = models.IntegerField(null=False, blank=False, default=0)

    def __str__(self):
        return (order)