Skip to content

Commit

Permalink
Fix KeyError in _rel_agnostic_fields_ref for uncommon rel.to setup
Browse files Browse the repository at this point in the history
django-taggit manually sets up `rel.to` and therefore there is no "to"
kwarg.

Fixes #22263
Ref: jazzband/django-taggit#206
  • Loading branch information
blueyed committed Mar 13, 2014
1 parent fc79c3f commit 8208b07
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion django/db/migrations/autodetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def _rel_agnostic_fields_def(fields):
for name, field in fields:
deconstruction = field.deconstruct()[1:]
if field.rel and field.rel.to:
del deconstruction[2]['to']
try:
del deconstruction[2]['to']
except KeyError:
# `rel.to` does not have to come from kwargs.
pass
fields_def.append(deconstruction)
return fields_def

Expand Down

0 comments on commit 8208b07

Please sign in to comment.