[Answered ]-Cannot correct a failed migration django

1👍

The best is probably to fix the migration file itself. In the migration file, it will probably looked like:

from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        # …
    ]

    operations = [
        migrations.CreateModel(
            name='MyModel',
            fields=[
                (
                    'id',
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name='ID',
                    ),
                ),
                (
                    'ordering',
                    models.IntegerField(
                        default='Order/position',
                    ),
                ),
            ],
        )
    ]

You fix this by altering the definition for ordering to the IntegerField you described.

Leave a comment