hi,

i posted this one week ago, could someone with commit access please 
respond to it?

thanks,
gabor


Gábor Farkas wrote:
> hi,
> 
> when django deletes an object (using the object's delete() method),
> then all related objects are also deleted.
> 
> this is not always a good thing.
> 
> there are various approaches to solve this, like:
> 
> http://code.djangoproject.com/ticket/1007
> and
> http://code.djangoproject.com/ticket/2288
> ,
> but they have been sitting there for a long time, and i don't think they 
> will be integrated anytime soon.
> 
> so maybe a simpler solution would be able to solve most of the needs:
> 
> a non-recursive (non-cascading) delete-method.
> 
> as far as i can understand the code, the recursive-delete works like this:
> 
> 1. collect all the objects to be deleted (using Model._collect_sub_objects)
> 
> 2. and then delete them using models.delete_objects
> 
> this proposed non-recursive delete would:
> 
> 1. the same as the previous step #1
> 
> 2. if step #1 returned more than one object, raise an exception. 
> otherwise delete the object
> 
> would this be acceptable?
> 
> actually, this can be implemented without changing django (i can simply 
> call into Model._collect_sub_objects, and see how many objects it 
> returns), but that means i am calling undocumented private methods, 
> which is not that nice. so maybe, even if my proposed solution is not 
> acceptable, would it be possible, to make Model._collect_sub_objects 
> into a normal, non-private method? so that at least i can be safe, that 
> an internal change won't break my code?
> 
> so, in short:
> 
> two proposals/possibilities:
> 
> 1. create a non-recursive delete-method (either by adding a 
> boolean-argument to Model.delete(), or by creating a new method)
> 
> 2. make Model._collect_sub_objects into a documented non-private method.
> 
> would any of these be suitable? if yes, i can create a patch for it, but 
> first i wanted to make sure that there's a chance for it to get accepted.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to