Re: modeling a book repository

2010-06-16 Thread Tim Arnold
One more reply after doing some more research. Apparently this has been discussed quite a bit and a solution may appear in the 1.3 release: http://code.djangoproject.com/ticket/7539 But, to handle the situation where you want to avoid a cascade delete (which was my problem with my previous/next li

Re: modeling a book repository

2010-06-15 Thread Tim Arnold
Thanks for both these great answers. After thinking about it, I think either way I go I'll need to modify both the add and delete methods. The linked list seems more natural to me, but since my writers will be using the interface, the sequence number may be a better choice for them. More to think

Re: modeling a book repository

2010-06-15 Thread Dan Harris
Hi Tim, You can probably override the Chapter model's delete method. Inside this overridden delete method you can swap around your FK's of previous and next chapters before calling the super classes delete. Basically do your linked list management inside the delete method before the calling the su

Re: modeling a book repository

2010-06-15 Thread Daniel Roseman
On Jun 15, 5:11 pm, Tim Arnold wrote: > Hi, > I have a model for a Book that contains Chapters. My problem is > figuring out the ordered sequence of Chapters in a Book. I first tried > setting Chapter up as a linked list with pointers to the previous > Chapter and next Chapter. That worked okay, b

modeling a book repository

2010-06-15 Thread Tim Arnold
Hi, I have a model for a Book that contains Chapters. My problem is figuring out the ordered sequence of Chapters in a Book. I first tried setting Chapter up as a linked list with pointers to the previous Chapter and next Chapter. That worked okay, but when I need to delete a Chapter, the prev/next