Skip to content

Snippet seems to use a BigAutoField but this is not reflected in the AppConfig #174

@jasperbok

Description

@jasperbok

Yesterday, I upgraded to the freshly released 5.0.0 version of this package. However, Django now warns me that the models in djangocms_snippet have changes that are not reflected in a migration.

When I let Django create a migration, this is what it contains:

...
operations = [
        migrations.AlterField(
            model_name='snippet',
            name='id',
            field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
        ),
        migrations.AlterField(
            model_name='snippetgrouper',
            name='id',
            field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
        ),
    ]

Looking into the migration history, it seems that djangocms_snippet uses a BigAutoField for snippetgrouper.id (as can be seen in migration 0014) and for snippet.id (as can been in migration 0010). Django's default, however, is AutoField.

According to Django's documentation, apps should configure their auto field type in the AppConfig.

The reason I'm creating an issue and not a PR (which I'm still willing to do) is that I see "DEFAULT_AUTO_FIELD": "django.db.models.AutoField", in HELPER_SETTINGS in settings.py, but I don't know how that is supposed to work. But at least it seems someone tried to set Autofield as the default …

Should I simply create a PR to configure the autofield on the AppConfig or must this be solved some other way?

My relevant package versions:

django==4.2.17
django-cms==3.11.9
djangocms-snippet==5.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions