diff options
| author | Shai Berger <shai@platonix.com> | 2017-01-29 00:33:13 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-01-31 08:02:18 -0500 |
| commit | 437e0ba5337e7bcc1425e1506675e6e780d06f42 (patch) | |
| tree | 847c80860aa4b58a000ee1800e612a19df584570 /django | |
| parent | 76a99f1b9ab6386685483fcd012a176c41d49363 (diff) | |
[1.11.x] Fixed #25192 -- Fixed squashmigrations crash with RunPython.noop on Python 2.
Thanks Adam Johnson for review.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/migrations/operations/special.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/django/db/migrations/operations/special.py b/django/db/migrations/operations/special.py index 66c5a3af27..9ca0b07b0b 100644 --- a/django/db/migrations/operations/special.py +++ b/django/db/migrations/operations/special.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals from django.db import router +from django.utils import six from .base import Operation @@ -203,3 +204,11 @@ class RunPython(Operation): @staticmethod def noop(apps, schema_editor): return None + + +# Allow migrations using RunPython.noop to be squashed on Python 2 (it doesn't +# support serializating unbound method so install a module function instead). +if six.PY2: + def noop(apps, schema_editor): + return None + RunPython.noop = staticmethod(noop) |
