I think it would make a lot of sense to require an explicit `on_delete` when a ForeignKey is nullable because of the ambiguity concerns raised on Trac.
However I'm not convinced this should be required for non-nullable ones since, IMHO, CASCADE is the most sensible default in this case. Le jeudi 26 septembre 2013 14:16:02 UTC-4, Carl Meyer a écrit : > > Hi all, > > I filed a ticket last week suggesting that we change the default from > on_delete=CASCADE to on_delete=SET_NULL for nullable ForeignKeys.[1] > > There's been some lively discussion on the ticket, and Michael Manfre > has suggested that we should instead transition to making on_delete a > required argument with no default. This forces the developer to think > about what deletion behavior they want, and means that there will never > be cascading data loss of any kind unless explicitly requested. > > I think either of these changes, but particularly the latter, is > significant enough that it deserves a mention here before a decision is > made. > > Any thoughts or arguments that haven't already been presented on the > ticket? > > Carl > > > [1] https://code.djangoproject.com/ticket/21127 > -- You received this message because you are subscribed to the Google Groups "Django developers" 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]. Visit this group at http://groups.google.com/group/django-developers. For more options, visit https://groups.google.com/groups/opt_out.
