﻿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
31392	Avoid calling SchemaEditor.effective_default() if not necessary.	Shipeng Feng	Shipeng Feng	"Example:


{{{
#!python
def old_default_code():
    return 'old'

def new_default_code():
    # running something that is stateful, for example, increase a database counter

class Student(models.Model):
    code = models.CharField(default=new_default_code)
}}}

We change the default callable object, and run {{{manage.py migrate}}}, ideally {{{new_default_code}}} shouldn't be
called, however, we are getting the model field default value no matter whether we need it or not:

https://github.com/django/django/blob/master/django/db/backends/base/schema.py#L679

I'd love to send a pull request for this if necessary."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Ready for checkin	1	0	0	0	1	0
