From a0ed3cfad1ac4873ecfd2baebaa2e978e483ba99 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Fri, 19 Nov 2021 21:45:33 +0100 Subject: Fixed #33305 -- Fixed autodetector crash for ForeignKey with hardcoded "to" attribute. Co-authored-by: Simon Charette --- django/db/migrations/autodetector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db') diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index 97977d72ef..bf9c2acd26 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -96,7 +96,7 @@ class MigrationAutodetector: for name, field in sorted(fields.items()): deconstruction = self.deep_deconstruct(field) if field.remote_field and field.remote_field.model: - del deconstruction[2]['to'] + deconstruction[2].pop('to', None) fields_def.append(deconstruction) return fields_def -- cgit v1.3