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

support dependencies = (...) #368

Open
graingert-coef opened this issue Dec 11, 2024 · 0 comments
Open

support dependencies = (...) #368

graingert-coef opened this issue Dec 11, 2024 · 0 comments

Comments

@graingert-coef
Copy link

Description

currently I have migrations like this:

# Generated by Django 4.2.17 on 2024-12-10 17:46
"""Add display_order field to Story model."""

from django.db import migrations, models


class Migration(migrations.Migration):
    """Migrations."""

    dependencies = (
        ("core", "0001_initial"),
    )

    operations = (
        migrations.AddField(
            model_name="story",
            name="display_order",
            field=models.PositiveIntegerField(
                default=0,
                help_text="Order of the story in the frontend display.",
            ),
        ),
    )

they use tuples for dependencies and operations to make mypy and ruff happy. django-stubs defines Migration.dependencies as an instance sequence, and ruff only allows mutable ClassVars to be defined as a class variable

rebase_migration fails to process these sorts of migration:

$ python manage.py rebase_migration core
CommandError: Could not find dependencies = [...] in '0005_story_display_order.py'
@graingert-coef graingert-coef changed the title support dependencies = ( ... ) support dependencies = (...) Dec 11, 2024
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