-
Notifications
You must be signed in to change notification settings - Fork 19
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
New migration needed for Wagtail 6.2 #71
Comments
I think we could conditionally do # wagtail_footnotes/models.py
from wagtail import VERSION as WAGTAIL_VERSION
...
if WAGTAIL_VERSION <= (6, 1):
Footnote._meta.get_field("locale").verbose_name = _("locale") which should sort this. If you have the time to give it a try, it would fantastic |
Unfortunately that doesn't appear to fool Django's migration model state/audodetector, because it does an independent resolution of model field relations (I believe that happens here) rather than it occurring after evaluation of this Long way to saying, Django still wants to generate a new migration with this operation: migrations.AlterField(
model_name='footnote',
name='locale',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
), |
Could we wrap the AlterField operation in a version check? class Migration(migrations.Migration):
dependencies = [...]
operations = []
if WAGTAIL_VERSION >= (6, 1):
operations.append(
migrations.AlterField(
model_name='footnote',
name='locale',
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
)
) This way, the final state that Django arrives at from evaluating the migrations will match the real model state, whichever Wagtail version it's run under. And if the I seem to remember us doing something similar in Wagtail itself, possibly as a result of django-taggit making a similarly minor change in a point release. |
Wagtail 6.2 alters the Locale model on TranslatableMixin, adding a verbose_name. Because Footnote inherits from TranslatableMixin, it needs a new migration generated for Wagtail 6.2. To maintain compatibility with Wagtail <= 6.1, this change makes the migration a noop. See torchbox#71 for context. Closes torchbox#71
Wagtail 6.2 alters the Locale model on TranslatableMixin, adding a verbose_name. Because Footnote inherits from TranslatableMixin, it needs a new migration generated for Wagtail 6.2. To maintain compatibility with Wagtail <= 6.1, this change makes the migration a noop. See torchbox#71 for context. Closes torchbox#71
* Add backwards-compatible locale verbose_name migration Wagtail 6.2 alters the Locale model on TranslatableMixin, adding a verbose_name. Because Footnote inherits from TranslatableMixin, it needs a new migration generated for Wagtail 6.2. To maintain compatibility with Wagtail <= 6.1, this change makes the migration a noop. See #71 for context. * Remove Wagtail 6.0 from test matrix Co-authored-by: Dan Braghiș <[email protected]>
* Add backwards-compatible locale verbose_name migration Wagtail 6.2 alters the Locale model on TranslatableMixin, adding a verbose_name. Because Footnote inherits from TranslatableMixin, it needs a new migration generated for Wagtail 6.2. To maintain compatibility with Wagtail <= 6.1, this change makes the migration a noop. See torchbox#71 for context. * Remove Wagtail 6.0 from test matrix Co-authored-by: Dan Braghiș <[email protected]>
Wagtail 6.2 alters the
Locale
model onTranslatableMixin
, adding averbose_name
. BecauseFootnote
inherits fromTranslatableMixin
, it needs a new migration generated for Wagtail 6.2.That's easy enough to generate, and I could do so and then PR the change, but I'm not sure how you all would want to handle the backward-incompatibility that would create with Wagtail < 6.1.
Currently, this is a blocker for our 6.2 upgrade as we have a required check in CI that runs
makemigrations --dry-run --check
to ensure there are no missing migrations.The text was updated successfully, but these errors were encountered: