creativecommons / legaldb

CC Legal Database: curated repository of Case Law and Scholarship data from around the world in a Django based website.
https://LegalDB.CreativeCommons.org/
MIT License
44 stars 54 forks source link

[Bug] Database warning: (models.W042) Auto-created primary key used when not defining a primary key type #121

Closed TimidRobot closed 2 years ago

TimidRobot commented 2 years ago

Description

WARNINGS:
legal_db.Case: (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 LegalDBConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
legal_db.FAQ: (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 LegalDBConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
legal_db.Link: (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 LegalDBConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
legal_db.Scholarship: (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 LegalDBConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

Reproduction

do most any Django thing

Expectation

Additional context

TimidRobot commented 2 years ago

I expect this can be fixed by adding

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

to caselaw/settings.py

(That file could also use some clean-up: remove auto-generated messages, update URLs to Django 3.2, etc.)