You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the new Django 3.2 version, makemigrations and migrate seem to raise a warning about AutoFields for the notification app.
WARNINGS:
notifications.Notification: (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 NotificationsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
To Reproduce
This happens on default when installing the most recent Django version 3.2
When defining a model, if no field in a model is defined with primary_key=True an implicit primary key is added. The type of this implicit primary key can now be controlled via the DEFAULT_AUTO_FIELD setting and AppConfig.default_auto_field attribute. No more needing to override primary keys in all models.
Maintaining the historical behavior, the default value for DEFAULT_AUTO_FIELD is AutoField. Starting with 3.2 new projects are generated with DEFAULT_AUTO_FIELD set to BigAutoField. Also, new apps are generated with AppConfig.default_auto_field set to BigAutoField. In a future Django release the default value of DEFAULT_AUTO_FIELD will be changed to BigAutoField.
The text was updated successfully, but these errors were encountered:
It seems to me that the least intrusive way of fixing this is adding the default_auto_field attribute to the NotificationsConfigApp to point to 'django.db.models.AutoField' or maybe even BigAutoField. Since existing projects use AutoField, I am tending to this one to not cause new migrations for all existing projects. I will implement and test this.
Description
With the new Django 3.2 version,
makemigrations
andmigrate
seem to raise a warning aboutAutoFields
for the notification app.To Reproduce
This happens on default when installing the most recent Django version 3.2
pip install Django==3.2 espressodb startproject temp cd temp python manage.py migrate
Additional context
Django 3.2 release notes: https://docs.djangoproject.com/en/3.2/releases/3.2/
The text was updated successfully, but these errors were encountered: