summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2021-11-19 21:45:33 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-11-22 06:46:25 +0100
commita0ed3cfad1ac4873ecfd2baebaa2e978e483ba99 (patch)
tree7ef2d63a8486514a1003af81fdbe1a302bbd357e /django
parenta7e7043c8746933dafce652507d3b821801cdc7d (diff)
Fixed #33305 -- Fixed autodetector crash for ForeignKey with hardcoded "to" attribute.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Diffstat (limited to 'django')
-rw-r--r--django/db/migrations/autodetector.py2
1 files changed, 1 insertions, 1 deletions
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