Closed bhrutledge closed 7 years ago
If you feel up to fixing this yourself, look through the official migrations and find the instances where it points to these raw choices values. You can fork this app and edit the migrations to instead point to the variable name instead of the raw values and then submit a pull request.
this has apparently also been raise on Django itself https://code.djangoproject.com/ticket/22837 @jsma do you know of a way to avoid it?
Can't find examples at the moment of where we've fixed this before in the django CMS ecosystem, but any time a model field points to a variable or callable for choices like https://github.com/divio/djangocms-style/blob/master/djangocms_style/models.py#L69, you need to edit the migrations to import this variable/callable and use that in the migration as well. Otherwise anytime that variable/callable returns a different result than it did last month (e.g. a setting changed), it's going to trigger new migrations. Apologies, but don't have time at the moment to put together a PR.
I just upgraded to 2.0.0, and discovered that setting
DJANGOCMS_STYLE_CHOICES
andDJANGOCMS_STYLE_TEMPLATES
results in changing the choices forclass_name
andtemplate
, which necessitates new migrations.I've pasted the relevant bits below. It looks any djangocms plugin that uses this pattern (-link, -picture, etc.) will display this behavior. I am not an expert on migrations, so it's not clear to me what problems it might cause, but it make me nervous about future conflicts, and having migrations outside of source control.
In my
settings.py
:Output of
python manage.py makemigrations
:Contents of
venv/lib/python2.7/site-packages/djangocms_style/migrations/0008_auto_20161116_1358.py
: