On Tue, Apr 2, 2013 at 4:59 PM, bobhaugen <bob.hau...@gmail.com> wrote: > There's a reason ERP systems have an order detail table. > > It might look something like: > > class OrderDetail(models.Model): > order = models.ForeignKey(Order) > item = models.ForeignKey('Item') > quantity = models.DecimalField(max_digits=8, decimal_places=2) > etc. > > (That's just to explain the idea, not necessarily exactly how you would do > it.) >
I would have these classes: Customer <customer fields> Item <item fields> Order M2M to Item, through LineItem Foreign key to Customer LineItem Foreign key to Order Foreign key to Item Quantity Per item cost If you do not store the price an item is offered at on the LineItem (as well as the Item), then if you change the price on an Item, you retrospectively change how an invoice would be presented. There may be plenty of other gotchas too, it's been a while since I wrote a cart. You could instead re-use one of the well supported and active e-commerce projects, LFS or Satchmo. There are others, but LFS and Satchmo are well known active projects. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.