On Mon, Aug 9, 2010 at 7:28 AM, Ersin Er <ersin...@gmail.com> wrote: > Hi, > > I was just trying the sample code from the Django Book 2nd Edition but > the generated SQL script for the Books models are not correct. > > The Model code: > > http://dpaste.com/226416/ > > The generated SQL script for sqlite: > > http://dpaste.com/226417/ > > What's missing in the generated script is > 'REFERENCES "books_book" ("id")' > for the "book_id" field > in the "books_book_authors" table. (The code listing in the book has > it.) > > Am I missing something or Django 1.2.1 just generates incorrect > script?
The SQL generated by Django 1.2.1 isn't incorrect - it's just different. Django 1.2 introduced a number of internal changes to the way many-to-many fields were represented; as a result, the output SQL has changed slightly. The output described by the Django Book is out of date, but not in any way that matters at a functional level -- the public API for using m2m fields remains unchanged. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.