#7539: Add ON DELETE and ON UPDATE support to Django
---------------------------------------------------+------------------------
          Reporter:  glassfordm                    |         Owner:         
            Status:  new                           |     Milestone:         
         Component:  Database layer (models, ORM)  |       Version:  SVN    
        Resolution:                                |      Keywords:  feature
             Stage:  Design decision needed        |     Has_patch:  1      
        Needs_docs:  1                             |   Needs_tests:  0      
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Comment (by glassfordm):

 I've attached a new patch containing a very preliminary version of what
 I'm working on for possible inclusion in the 1.2 release. As discussed in
 the django developer mailing list some time ago, it has a much more
 limited scope than my original patch in these ways:
 1) It removes all ON UPDATE type behavior.
 2) It removes the feature that allows the backend to provide the ON DELETE
 support and to cause Django to generate SQL with ON DELETE clauses in it.
 3) It removes the settings that could be added to the settings files to
 control these behaviors.
 It is my hope that #2, and possibly #1, can be added in future versions of
 Django 1.2.

 The patch I've attached is very preliminary in these ways:
 1) It contains some debugging code (commented out) and some TODO comments
 indicating things that need to be improved.
 2) Some areas could use efficiency improvements.
 3) It contains several intentionally failing tests illustrating problems I
 haven't yet solved.
 4) There are no docs yet.
 5) I've made no attempt to support any of the alternate terminology
 suggestions from this discussion: http://groups.google.com/group/django-
 developers/browse_thread/thread/4ece22d6053f774b/8be0b9be9b6d0b5f. This
 doesn't mean I won't, just that I haven't. Ideally, I'd prefer comments
 from more people on the suggestion that were made before choosing one of
 them.

 I've posted this patch to give an idea what the final patch is attempting
 to implement and to ask for help on the problems I haven't solved yet.

 What's here: OneToOne and ForeignKey field types in models have a new
 attribute, on_delete. This can be set to CASCADE, PROTECT, SET_NULL, or
 SET_DEFAULT. If any of these attributes are present in a foreign key
 definition, Django implements the appropriate behavior when an attempt is
 made to delete an item referenced by that foreign key.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7539#comment:27>
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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to