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

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

Open
jasperbok opened this issue Jan 14, 2025 · 0 comments

Comments

@jasperbok
Copy link

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
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