Re: I'm missing something with Models and database migrations

2016-01-02 Thread Michael Molloy
Thank you both. --M On Monday, December 28, 2015 at 1:09:08 AM UTC-6, Peter of the Norse wrote: > > OK. Let’s take a look at the documentation > . > > Here is what you are looking for: > > clas

Re: I'm missing something with Models and database migrations

2015-12-27 Thread Peter of the Norse
OK. Let’s take a look at the documentation . Here is what you are looking for: class Invoice(models.Model): invoice_date = models.DateField(‘created date’, auto_now=True) line_item_set =

Re: I'm missing something with Models and database migrations

2015-12-23 Thread Vijay Khemlani
If you want to make the middle table by yourself then those ManyToManyField need to be ForeignKey instead. On Wed, Dec 23, 2015 at 2:33 AM, Michael Molloy wrote: > I figured it out, again with help from Vijay. Thanks for getting me > thinking in the right direction. > > So here is my cross refer

Re: I'm missing something with Models and database migrations

2015-12-22 Thread Michael Molloy
I figured it out, again with help from Vijay. Thanks for getting me thinking in the right direction. So here is my cross reference model: class Invoice_Line_Items(models.Model): created_dt = models.DateField('created date', auto_now=True) invoice = models.ManyToManyField(Invoices) line_item =

Re: I'm missing something with Models and database migrations

2015-12-22 Thread Michael Molloy
Still confused. I think I still need to create the cross reference Django model myself, and then use makemigrations to turn it into a table. I need a place to store invoices and associated line items, so if the model code I put in my first post is incorrect, what should it look like? --Michael

Re: I'm missing something with Models and database migrations

2015-12-22 Thread Michael Molloy
I was trying to create the cross reference table myself. I'm coming at this from a java/oracle background where I would create two tables (invoices and line_items), and then a third (invoice_line_item_xref) that would contain invoice IDs and associated line item IDs. I think you just helped me s

Re: I'm missing something with Models and database migrations

2015-12-22 Thread Vijay Khemlani
You have two pairs of fields with the same name (line_item_id and invoice_id), what are you trying to do exactly? Why the IntegerFields? In a Many To Many relation the columns are added to a third table between the models. On Tue, Dec 22, 2015 at 9:20 PM, Michael Molloy wrote: > Python 3.3 and