django-rq-jobs icon indicating copy to clipboard operation
django-rq-jobs copied to clipboard

Spurious migrations

Open palm86 opened this issue 9 years ago • 0 comments

Django creates AlterField migrations when the choices of a field change. This means that, because of this line:

task = models.CharField(max_length=200, choices=task_list())

Django wants to make a migration every time the task list is updated. I'm wondering if something like

self._meta.get_field_by_name('task')[0]._choices = task_list()

inside __init__ could work instead. That said, get_field_by_name is about to be deprecated and should probably simply be get_field.

palm86 avatar Feb 21 '16 15:02 palm86