On 09/26/2013 03:17 PM, Christophe Pettus wrote:
> It's a breaking change, so that's going to be a significant amount of
> upgrade work for existing applications.

Yes, it would certainly require a deprecation path, so people would have
the course of several Django versions to update their code.

> I also think we *really* need to push execution of this functionality
> into the database rather than having the Django core do it, if we're
> going to be making more use of on_delete.

We already provide the on_delete=DO_NOTHING option for people who want
to push cascade handling to the database. Making on_delete a required
argument might encourage more people to consider this option, since
they'll have to actually consider the issue in the first place.

I don't think it's feasible to push all on_delete handling to the
database, for several reasons:

1) The on_delete API allows you to execute arbitrary Python code at
deletion time, via the SET() option, and to access the Python-level
field default (which can also be callable), via the SET_DEFAULT option.
These can't be pushed to the database, so we'd have to remove
functionality to do this.

2) Even if we wanted to just switch the CASCADE option to be executed in
the database by default, this would have significant
backwards-compatibility impacts in terms of signals not being fired for
related objects, related objects in memory not being updated, etc.
You're welcome to take a stab at this, but my feeling is that it's not
worth it; better for those people who actually need the efficiency of
db-level cascades to opt into those changes explicitly via
on_delete=DO_NOTHING.

Carl

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to