﻿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
35854	"Order of ""choices"" on CharField randomly changing forcing new migrations despite no changes."	Karl		"I have a field `attachment_type` in a class that uses

{{{
TYPE_CHOICES = {
        (""image"", ""Image""),
        (""document"", ""Document""),
        (""audio"", ""Audio""),
        (""video"", ""Video""),
    }
}}}

Every `makemigrations` call generates a new migration for that field:

{{{
migrations.AlterField(
            model_name=""genericattachment"",
            name=""attachment_type"",
            field=models.CharField(
                choices=[
                    (""audio"", ""Audio""),
                    (""document"", ""Document""),
                    (""video"", ""Video""),
                    (""image"", ""Image""),
                ],
                default=""image"",
                max_length=10,
            ),
        ),
}}}

I noticed that the order of the choices in the migration changes every time. It doesn't seem to have a consistent method to compare the set of tuples properly and so it generates a new migration every time. I have not yet observed that it even accidentally collides in a way that does not generate a new one."	Bug	closed	Migrations	5.1	Normal	duplicate		Karl	Unreviewed	0	0	0	0	0	0
