﻿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
28980	Make the autodetector validate the type of one-off default values	Nikos Katsos		"As the title says Django doesn't check the type of one-off value. Recently I had a field like this

{{{
    start_time = models.DateTimeField(editable=False)
}}}

1) I gave to the field an one-off value 
{{{ 
>>> 0 
}}}

2) then the migration file had those operations 

{{{
    operations = [
        migrations.AddField(
            model_name='x',
            name='outcome',
            field=models.CharField(default='TO', max_length=16),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='x',
            name='start_time',
            field=models.DateTimeField(default=0 editable=False),
            preserve_default=False,
        ),
    ]
}}}

when I found my error i couldn't really do anything
I changed 
{{{
            field=models.DateTimeField(default=0, editable=False),
}}}
to 
{{{
            field=models.DateTimeField(default=timezone.now, editable=False),
}}}

so after updating my migration file, I got an error ""django.db.utils.OperationalError: (1060, ""Duplicate column name ""outcome"")"".
I could neither re-migrate because the operations isn't a bunch of queries in transaction, nor create a new migration.
Only reverting to zero and apply all migrations again worked.

This has to have a workaround."	Cleanup/optimization	new	Migrations	2.0	Normal			Jeff	Accepted	0	0	0	0	0	0
