﻿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
25908	migrations fail when default function is removed	Rapolas K.	nobody	"Whenever you set a default value for a model field to a function and make a migration, you can't remove the function afterwards. Migration fails to find the function in the module. 

For example if you make a migration of this code:
{{{
#!div style=""font-size: 80%""
{{{#!python
def my_value():
    return 'a'

class MyModel(models.Model):
    myfield = models.CharField(max_length=10, default=my_value)
}}}
}}}

you can't remove `my_value` function even if you remove `default` from the field. And then you have to leave something like this in your code for migrations to work:
{{{#!div style=""font-size: 80%""
def my_value(): pass
}}}
or 
{{{#!div style=""font-size: 80%""
my_value = lambda: None
}}}

It is not a problem for me, as my project is small and I don't mind recreating migrations without default function, but I see this as an issue because you might have to leave some dead code in your app, just for the migrations to work."	Uncategorized	closed	Migrations	1.9	Normal	invalid			Unreviewed	0	0	0	0	0	0
