diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index f4523e4e82..c9243febf7 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -366,7 +366,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): def check_constraints(self, table_names=None): """ - Checks each table name in table-names for rows with invalid foreign key references. This method is + Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows with invalid references were entered while constraint checks were off. diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index f922d38638..e3c12f7583 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -208,7 +208,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): def check_constraints(self, table_names=None): """ - Checks each table name in table-names for rows with invalid foreign key references. This method is + Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows with invalid references were entered while constraint checks were off. diff --git a/tests/regressiontests/fixtures_regress/fixtures/forward_ref.json b/tests/regressiontests/fixtures_regress/fixtures/forward_ref.json new file mode 100644 index 0000000000..237b076243 --- /dev/null +++ b/tests/regressiontests/fixtures_regress/fixtures/forward_ref.json @@ -0,0 +1,17 @@ +[ + { + "pk": 1, + "model": "fixtures_regress.book", + "fields": { + "name": "Cryptonomicon", + "author": 4 + } + }, + { + "pk": "4", + "model": "fixtures_regress.person", + "fields": { + "name": "Neal Stephenson" + } + } +] \ No newline at end of file diff --git a/tests/regressiontests/fixtures_regress/fixtures/forward_ref_bad_data.json b/tests/regressiontests/fixtures_regress/fixtures/forward_ref_bad_data.json new file mode 100644 index 0000000000..3a3fb64360 --- /dev/null +++ b/tests/regressiontests/fixtures_regress/fixtures/forward_ref_bad_data.json @@ -0,0 +1,17 @@ +[ + { + "pk": 1, + "model": "fixtures_regress.book", + "fields": { + "name": "Cryptonomicon", + "author": 3 + } + }, + { + "pk": "4", + "model": "fixtures_regress.person", + "fields": { + "name": "Neal Stephenson" + } + } +] \ No newline at end of file