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 super class delete. This way when the cascades
go through it doesn't have links to next or previous chapters and not
everything is deleted.

Hope this helps,

Dan Harris
dih0...@gmail.com

On Jun 15, 12:11 pm, Tim Arnold <a_j...@bellsouth.net> 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, but when I need to delete
> a Chapter, the prev/next links cascade through and it wants to delete
> all the chapters.
>
> I'm now thinking of adding a 'sequence number' to the chapter model
> which I suppose will work okay, but if want to add or delete a chapter
> later on, I'll have to renumber all the later chapters in the
> database.
>
> This is a little tricky--does anyone have a better solution?
> thanks,
> --Tim Arnold

-- 
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.

Reply via email to