#14043: Incorrect and/or confusing behaviour with nullable OneToOneField
---------------------------------------------------+------------------------
          Reporter:  theevilgeek                   |         Owner:             
                              
            Status:  new                           |     Milestone:             
                              
         Component:  Database layer (models, ORM)  |       Version:  SVN        
                              
        Resolution:                                |      Keywords:  
OneToOneField, cascading delete, nullable
             Stage:  Design decision needed        |     Has_patch:  0          
                              
        Needs_docs:  0                             |   Needs_tests:  0          
                              
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by gsakkis):

  * stage:  Accepted => Design decision needed

Comment:

 Replying to [comment:1 gsakkis]:
 >
 > Why do an update if it is going to be deleted right after ?

 Ugh, scratch that, I missed the `self.save()` in `become_ghost()`, that's
 where the UPDATE comes from; nothing to do with `self.delete()`.

 Back to the topic, it comes down to Django's indiscriminate ON DELETE
 CASCADE behavior, regardless of whether the ForeignKey/OneToOneField is
 nullable. IMO it would make more sense to treat nullable keys as ON DELETE
 SET NULL but that would most likely be backwards incompatible at this
 point. Changing to design decision needed, just in case.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14043#comment:5>
Django <http://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 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-updates?hl=en.

Reply via email to