From 1be99e4e0a590d9a008da49e8e3b118b57e14075 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 10 Dec 2021 08:22:09 +0000 Subject: [PATCH] Corrected return value of ForeignKey.db_check(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Field.db_check() should return None or a SQL string. Returning [] happened to work because it’s falsey. --- django/db/models/fields/related.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 8533803ba6..11407ac902 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -1035,7 +1035,7 @@ class ForeignKey(ForeignObject): }) def db_check(self, connection): - return [] + return None def db_type(self, connection): return self.target_field.rel_db_type(connection=connection)