From bbbd698c7a4dd19e6394660bece7e6e907b0a824 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 7 Mar 2013 11:24:51 -0800 Subject: Added a ManyToManyField(db_constraint=False) option, this allows not creating constraints on the intermediary models. --- docs/ref/models/fields.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'docs/ref/models') diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 1dbc8c3998..1b80196183 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1227,6 +1227,20 @@ that control how the relationship functions. the table for the model defining the relationship and the name of the field itself. +.. attribute:: ManyToManyField.db_constraint + + Controls whether or not constraints should be created in the database for + the foreign keys in the intermediary table. The default is ``True``, and + that's almost certainly what you want; setting this to ``False`` can be + very bad for data integrity. That said, here are some scenarios where you + might want to do this: + + * You have legacy data that is not valid. + * You're sharding your database. + + It is an error to pass both ``db_constraint`` and ``through``. + + .. _ref-onetoone: ``OneToOneField`` -- cgit v1.3