Re: Data Structure - Orders and multiple items

2013-04-02 Thread Tom Evans
On Tue, Apr 2, 2013 at 4:59 PM, bobhaugen 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_

Re: Data Structure - Orders and multiple items

2013-04-02 Thread bobhaugen
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

Re: Data Structure - Orders and multiple items

2013-03-31 Thread Siddharth Ghumre
Sorry for the half response...please ignore the previous message. class order(models.Model): order_id = models.IntegerField(unique=True) customer_id = models.ForeignKey('Customer') item_id = models.ForeignKey('Item') qty = models.IntegerField() This will you give the provision to

Re: Data Structure - Orders and multiple items

2013-03-31 Thread Siddharth Ghumre
Hi As per my view you can modify your models as follows:- class order(models.Model): order_id = models.IntegerField(unique=True) customer_id = models.ForeignKey('Customer') item_id = models.ForeignKey('Item') On Mon, Apr 1, 2013 at 10:30 AM, Lachlan Musicman wrote: > On 1 April

Re: Data Structure - Orders and multiple items

2013-03-31 Thread Lachlan Musicman
On 1 April 2013 15:07, Eric Lovrien wrote: > I am not sure of how or the best way to structure my data in models.py. I > would like to have an order and allow multiple items / products to be added > to an order. I know I can do a ManyToMany field but not sure how I would > connect a qty to that. I