Skip to content

Instantly share code, notes, and snippets.

@CapnKernel
Created January 7, 2015 03:06
Show Gist options
  • Select an option

  • Save CapnKernel/dec1565f5b8e9288a7ca to your computer and use it in GitHub Desktop.

Select an option

Save CapnKernel/dec1565f5b8e9288a7ca to your computer and use it in GitHub Desktop.
# This class represents the once-per-order information.
class Order(models.Model):
id = models.AutoField(primary_key=True)
hash = models.CharField(max_length=hash_length, unique=True, editable=False)
customer = models.ForeignKey('Customer')
payment_method = models.CharField(max_length=384)
payment_module_code = models.CharField(max_length=96)
shipping_method = models.CharField(max_length=384)
shipping_module_code = models.CharField(max_length=96)
agent = models.ForeignKey(ShippingAgent, null=True, blank=True)
# Combo orders: If we get sent in another order, here's that order that will carry us.
combo_info = models.ForeignKey('Order', related_name='slaves', null=True, blank=True)
tracking_no = models.CharField(max_length=201, null=True, blank=True)
date_purchased = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
status = models.ForeignKey('OrderStatus')
obscure = models.BooleanField(default=False, help_text="Should we make this order a bit harder to see?")
items = models.ManyToManyField('Product', through='Item')
payment_claimed = models.NullBooleanField(db_column='orders_payment_claimed', default=False)
payment_confirmed = models.NullBooleanField()
payment_notes = models.TextField(blank=True)
next_issued_invoice_id = models.IntegerField(default=0)
flags = models.ManyToManyField('Flag', through='OrderFlag')
customer_reference = models.CharField(max_length=100, blank=True, help_text="Put something here to remind you what this order was for.")
customers_name = models.CharField(max_length=64L, blank=True)
customers_company = models.CharField(max_length=64L, blank=True)
customers_street_address = models.CharField(max_length=64L, blank=True)
customers_suburb = models.CharField(max_length=32L, blank=True)
customers_city = models.CharField(max_length=32L, blank=True)
customers_postcode = models.CharField(max_length=10L, blank=True)
customers_state = models.CharField(max_length=32L, blank=True)
customers_country = models.CharField(max_length=32L, blank=True)
customers_telephone = models.CharField(max_length=32L, blank=True)
customers_email_address = models.CharField(max_length=96L, blank=True)
customers_address_format_id = models.IntegerField(default=1)
delivery_name = models.CharField(max_length=64L, blank=True)
delivery_company = models.CharField(max_length=64L, blank=True)
delivery_street_address = models.CharField(max_length=64L, blank=True)
delivery_suburb = models.CharField(max_length=32L, blank=True)
delivery_city = models.CharField(max_length=32L, blank=True)
delivery_postcode = models.CharField(max_length=10L, blank=True)
delivery_state = models.CharField(max_length=32L, blank=True)
delivery_country = models.CharField(max_length=32L, blank=True)
delivery_address_format_id = models.IntegerField(default=1)
billing_name = models.CharField(max_length=64L, blank=True)
billing_company = models.CharField(max_length=64L, blank=True)
billing_street_address = models.CharField(max_length=64L, blank=True)
billing_suburb = models.CharField(max_length=32L, blank=True)
billing_city = models.CharField(max_length=32L, blank=True)
billing_postcode = models.CharField(max_length=10L, blank=True)
billing_state = models.CharField(max_length=32L, blank=True)
billing_country = models.CharField(max_length=32L, blank=True)
billing_address_format_id = models.IntegerField(default=1, blank=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment