Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2024-03-12 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+-
 Reporter:  Waldemar Kornewald   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pre_delete signals   | Triage Stage:  Accepted
  related|
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Ülgen Sarıkavak):

 * cc: Ülgen Sarıkavak (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e32f99e3b-1ff7e27a-de0d-4fa0-8cf1-98d73c9c00b3-00%40eu-central-1.amazonses.com.


Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2018-11-29 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+-
 Reporter:  Waldemar Kornewald   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pre_delete signals   | Triage Stage:  Accepted
  related|
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tiedye):

 Will this be addressed at any point?  I've been running into this issue
 for the past month.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.a811bc6cddc4767a0e3258e78596e469%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2013-03-21 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+-
 Reporter:  wkornewald   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  pre_delete signals   |  Needs documentation:  1
  related|  Patch needs improvement:  1
Has patch:  1|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-

Comment (by anonymous):

 I've run in the same problem, not easy to debug. I'd be great to see it
 fixed someday.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2011-12-20 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+-
 Reporter:  wkornewald   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  SVN
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  pre_delete signals   |  Needs documentation:  1
  related|  Patch needs improvement:  1
Has patch:  1|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-

Comment (by ambv):

 There are more use-cases than that. One of those is Admin's object
 deletion. Let me give you an example:

 I have a `Team` model and a `Member` model. `Team`s have `Member`s.
 Trivial stuff. I also log every change on a `Team` or its `Member`s by
 creating `LogEntry` objects. So, when a `Member` is deleted, I have a
 `pre_delete` signal that saves the `LogEntry` ("member parted") for the
 related `Team`. Now, when I try to delete a `Team` from the Admin, during
 deletion of existing `Member`s, log entries are created by the
 `pre_delete` signal and the transaction fails.

 Currently as a workaround you have to either let orphaned objects litter
 the DB by using `on_delete` or to create another `pre_delete` signal for
 the `Team` model which does `instance.logentry_set.all().delete()`.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2011-09-08 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+-
   Reporter: |  Owner:  nobody
  wkornewald | Status:  new
   Type:  Bug|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  SVN|   Severity:  Normal
 Resolution: |   Keywords:  pre_delete signals
   Triage Stage:  Accepted   |  related
Needs documentation:  1  |  Has patch:  1
Patch needs improvement:  1  |Needs tests:  0
  UI/UX:  0  |  Easy pickings:  0
-+-
Changes (by jashugan):

 * cc: jashugan (added)


Comment:

 The original use-case still exists for generic relations, which does not
 support the on_delete functionality given by #7593.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2011-09-08 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+-
   Reporter: |  Owner:  nobody
  wkornewald | Status:  new
   Type:  Bug|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  SVN|   Severity:  Normal
 Resolution: |   Keywords:  pre_delete signals
   Triage Stage:  Accepted   |  related
Needs documentation:  1  |  Has patch:  1
Patch needs improvement:  1  |Needs tests:  0
  UI/UX:  0  |  Easy pickings:  0
-+-
Changes (by jrothenbuhler):

 * cc: jakerothenbuhler@… (added)
 * ui_ux:   => 0
 * easy:   => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2011-03-15 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+-
   Reporter: |Owner:  nobody
  wkornewald |Milestone:
 Status:  new|  Version:  SVN
  Component:  Database   | Keywords:  pre_delete signals
  layer (models, ORM)|  related
 Resolution: |Has patch:  1
   Triage Stage:  Accepted   |  Needs tests:  0
Needs documentation:  1  |
Patch needs improvement:  1  |
-+-
Changes (by koto):

 * cc: code@… (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2011-02-27 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
+---
   Reporter:  wkornewald| Owner:  
nobody
 Status:  new   | Milestone:

  Component:  Database layer (models, ORM)  |   Version:  SVN   

 Resolution:|  Keywords:  
pre_delete signals related
   Triage Stage:  Accepted  | Has patch:  1 

Needs documentation:  1 |   Needs tests:  0 

Patch needs improvement:  1 |  
+---
Changes (by julien):

  * component:  Core framework => Database layer (models, ORM)


Comment:

 See a possibly related feature request in #13251.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2010-11-09 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+--
  Reporter:  wkornewald  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Core framework  |   Version:  SVN  
 
Resolution:  |  Keywords:  pre_delete signals 
related
 Stage:  Accepted| Has_patch:  1
 
Needs_docs:  1   |   Needs_tests:  0
 
Needs_better_patch:  1   |  
-+--
Changes (by carljm):

  * needs_better_patch:  0 => 1
  * stage:  Design decision needed => Accepted

Comment:

 Now that #7539 is fixed, the use-case scope here is reduced. Nevertheless,
 moving the signal to fire before related objects are collected is not
 particularly difficult, seems reasonable, and increases the usefulness of
 the signal. In my preliminary test, doing so causes only one test failure,
 and that is spurious (because pre_delete signal is being used to test the
 order of actual deletion).

 The only concern I have here is the subtle backwards-incompatibility
 reflected by that test failure: pre-delete signals will now fire in a
 different order than previously. OTOH, the documentation makes no
 guarantees about order of pre_delete signals firing, and if anything the
 order after this change is more logical (it would now be the order of
 collection).

 The patch will look quite different now that #7539 has landed. Here's an
 initial take on it, but I haven't yet resolved the failing deletion-order
 test: https://github.com/carljm/django/compare/master...t6870

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2010-11-08 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+--
  Reporter:  wkornewald  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Core framework  |   Version:  SVN  
 
Resolution:  |  Keywords:  pre_delete 
signals related
 Stage:  Design decision needed  | Has_patch:  1
 
Needs_docs:  1   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Changes (by chrischambers):

 * cc: chrischambers (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2010-05-13 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+--
  Reporter:  wkornewald  | Owner:  nobody   
 
Status:  new | Milestone:   
 
 Component:  Core framework  |   Version:  SVN  
 
Resolution:  |  Keywords:  pre_delete 
signals related
 Stage:  Design decision needed  | Has_patch:  1
 
Needs_docs:  1   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Changes (by cgieringer):

  * keywords:  => pre_delete signals related
  * needs_tests:  1 => 0

Comment:

 I added a test that deletes a model and asserts that another model with a
 foreign key to it had the opportunity to be rescued from deletion via a
 pre_delete signal

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2010-05-13 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+--
  Reporter:  wkornewald  | Owner:  nobody
Status:  new | Milestone:
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Design decision needed  | Has_patch:  1 
Needs_docs:  1   |   Needs_tests:  1 
Needs_better_patch:  0   |  
-+--
Changes (by cgieringer):

 * cc: cgieringer (added)
  * needs_docs:  0 => 1
  * has_patch:  0 => 1
  * needs_tests:  0 => 1

Comment:

 I agree with the ticket creator that django should send the pre_delete
 signal at a time when it is still possible to modify the model in a way
 that affects deletion.  It seems that the contract of all pre_xx signal
 should include informing listeners before any undoable changes have
 occurred in the deletion, save, etc.

 The most common usage for a correctly behaving pre_delete signal is
 apparently to remove related objects to prevent cascade deletion, and the
 feature requested in #7539 would eventually provide another means to that
 usage.  But that possible feature doesn't change the fact that pre_delete
 breaks its contract (or what it seems its contract should be) by
 collecting the related objects for deletion before informing listeners
 that the objects will be deleted, thereby offering no consistent way to
 prevent cascade deletion.  The only way to get around this limitation is
 to define both a custom model delete and manager delete for each model
 requiring this functionality, which is a tedious and error-prone
 requirement.

 Currently the pre_delete signal is sent from
 django.db.models.query.delete_objects.  The least-complicated place to
 send the signal while meeting its contract is from the beginning of
 _collect_sub_objects, because this is both the first place that related
 objects are seen (as that method traverses relations from the original
 model) and the last place that a change to a model's related objects can
 be made before they are cached in seen_objects and then sent for deletion.

 I have attached a patch which adds a pre_signal argument to
 django.db.model.base.Model's _collect_sub_objects.  The argument should be
 one of Django's signals from django.db.models.signals, and it will be
 called at the beginning of the method if the model was not autocreated.
 The argument is called pre_signal because although _collect_sub_objects is
 presently only used for finding related objects for deletion, it could
 possibly be used for some other purpose for which a different pre_xx
 signal should be sent.  The patch adds _collect_sub_objects(...,
 pre_signal=pre_signal) to recursions and _collect_sub_objects(...,
 pre_signal=pre_delete) to the two places the method is called.  It removes
 the sending of pre_delete from delete_objects.

 Thank you to all the Django developers, this framework is my favorite
 piece of software.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2010-02-17 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+--
  Reporter:  wkornewald  | Owner:  nobody
Status:  new | Milestone:
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Design decision needed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by rudi):

 It seems, there's alternative approach for such usecase #12899, which I
 belive, is more consistent.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #6870: pre_delete should be sent before collecting ForeignKey relationships

2009-05-22 Thread Django
#6870: pre_delete should be sent before collecting ForeignKey relationships
-+--
  Reporter:  wkornewald  | Owner:  nobody
Status:  new | Milestone:
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Design decision needed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by semenov):

 While it actually '''is''' a symptom of a different (yet unsolved!)
 problem, the original suggestion makes sense per se. It shouldn't be
 disregarded just because that will magically allow to do some (useful)
 unrelated things, right?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---