﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25192	Can't Squash Migration that uses migrations.RunPython.noop in Python 2	James Pulec	Shai Berger	"When trying to squash a set of migrations, if one of them uses migrations.RunPython.noop for a backwards or forward operation, a ValueError is raised due to an attempt to serialize an unbound method. Not sure if there should be a special check for that operation when attempting to run squashmigrations with Python2.

Traceback:
{{{
Traceback (most recent call last):
  File ""manage.py"", line 17, in <module>
    execute_from_command_line(sys.argv)
  File ""/var/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 338, in execute_from_command_line
    utility.execute()
  File ""/var/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/var/venv/local/lib/python2.7/site-packages/django/core/management/base.py"", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File ""/var/venv/local/lib/python2.7/site-packages/django/core/management/base.py"", line 444, in execute
    output = self.handle(*args, **options)
  File ""/var/venv/local/lib/python2.7/site-packages/django/core/management/commands/squashmigrations.py"", line 141, in handle
    fh.write(writer.as_string())
  File ""/var/venv/local/lib/python2.7/site-packages/django/db/migrations/writer.py"", line 166, in as_string
    operation_string, operation_imports = OperationWriter(operation).serialize()
  File ""/var/venv/local/lib/python2.7/site-packages/django/db/migrations/writer.py"", line 124, in serialize
    _write(arg_name, arg_value)
  File ""/var/venv/local/lib/python2.7/site-packages/django/db/migrations/writer.py"", line 87, in _write
    arg_string, arg_imports = MigrationWriter.serialize(_arg_value)
  File ""/var/venv/local/lib/python2.7/site-packages/django/db/migrations/writer.py"", line 435, in serialize
    % (value.__name__, module_name, get_docs_version()))
ValueError: Could not find function noop in django.db.migrations.operations.special.
Please note that due to Python 2 limitations, you cannot serialize unbound method functions (e.g. a method declared and used in the same class body). Please move the function into the main module body to use migrations.
}}}"	Bug	closed	Migrations	1.8	Normal	fixed	py2	Shai Berger	Accepted	1	0	0	0	0	0
