altering GeneratedFields

Before re-opening #35061 (Modifying GeneratedFields is not supported - not documented under model field reference for GeneratedField) – Django or submitting a new ticket, I was hoping to get some clarification here first.

I completely understand that modifying a GeneratedField is either not possible, or comes with so many caveats that it’s not worth supporting in Django. However, Django will happily generate the AlterField migration and then error out trying to run it. Is it possible to refuse to generate the AlterField, either entirely or maybe just when the expression changes (allowing for renaming, for example)? Or even better, generate the migration as a RemoveField/AddField pair?

1 Like

I don’t have any insight, but was just wondering the same thing, as I finally got to use a GeneratedField myself. Thank you for starting this topic!

I think if we don’t support AlterField, then this would be a better developer experience.