When running the development server on django 3.2, wagtail 2.13, the following warning is shown:
WARNINGS:
wagtailmenus.FlatMenu: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the WagtailMenusConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
wagtailmenus.FlatMenuItem: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the WagtailMenusConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
wagtailmenus.MainMenu: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the WagtailMenusConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
wagtailmenus.MainMenuItem: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the WagtailMenusConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
Subclassing WagtailMenusConfig looks like a workaround, e.g.:
class CustomWagtailMenusConfig(WagtailMenusConfig):
"""Fix warning models.W042, regarding auto-created primary keys without a
defined type.
https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys
"""
default_auto_field = "django.db.models.BigAutoField"
Happy to throw together a PR which adds a default_auto_field declaration to WagtailMenusConfig.
When running the development server on django 3.2, wagtail 2.13, the following warning is shown:
Subclassing
WagtailMenusConfig
looks like a workaround, e.g.:Happy to throw together a PR which adds a
default_auto_field
declaration toWagtailMenusConfig
.Django 3.2 release notes Django apps