#26722: Django silently discarding the user-provided on_delete with 
GenericRelation
--------------------------------------+------------------------------------
     Reporter:  Delizin               |                    Owner:  nobody
         Type:  Bug                   |                   Status:  new
    Component:  contrib.contenttypes  |                  Version:  1.9
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Humberto Rocha):

 Hi, I have some models that rely at GenericRelations and recently
 discovered that some data was disappearing from the database so i
 discovered that issue.

 There's any explanation on why GenericRelations can not have a SET_NULL or
 even DO_NOTING implemented as a possible option of on_delete parameter?

 The docs only states that "Unlike ForeignKey, GenericForeignKey does not
 accept an on_delete argument to customize this behavior; if desired, you
 can avoid the cascade-deletion simply by not using GenericRelation, and
 alternate behavior can be provided via the pre_delete signal." which is
 kind of vague.

 Currently I am trying to tweak a little the GenericRelation code to see if
 I can add at least the DO_NOTING behavior to it but even if I change the
 this hardcoded line
 
[https://github.com/django/django/blob/c02d473781dc2e8699db8edd37cc77f7d43993fc/django/contrib/contenttypes/fields.py#L297]
 from CASCADE to DO_NOTHING it seems to be ignored.

 If anyone could help me out by pointing the way to follow on that would be
 very helpful

-- 
Ticket URL: <https://code.djangoproject.com/ticket/26722#comment:2>
Django <https://code.djangoproject.com/>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.939b10e513a024e7235f1a7f06b7c2ce%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to