Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious migrations #3

Open
palm86 opened this issue Feb 21, 2016 · 0 comments
Open

Spurious migrations #3

palm86 opened this issue Feb 21, 2016 · 0 comments

Comments

@palm86
Copy link

palm86 commented Feb 21, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant