Skip to content

Commit

Permalink
Django autofields (#429)
Browse files Browse the repository at this point in the history
Added settings for Default Auto Fields for Django 3.2

Co-authored-by: Vince Salvino <[email protected]>
  • Loading branch information
rcoldiron and vsalvino authored Aug 3, 2021
1 parent d7e45ed commit 01f605f
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 1 deletion.
9 changes: 9 additions & 0 deletions coderedcms/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.apps import AppConfig


class CoderedcmsConfig(AppConfig):
name = 'coderedcms'
verbose_name = 'CodeRed CMS'
# TODO: At some point in the future, change this to BigAutoField and create
# the corresponding migration for concrete models in coderedcms.
default_auto_field = 'django.db.models.AutoField'
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,8 @@
# Tags

TAGGIT_CASE_INSENSITIVE = True


# Sets default for primary key IDs
# See https://docs.djangoproject.com/en/{{ docs_version }}/ref/models/fields/#bigautofield
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,8 @@
# Tags

TAGGIT_CASE_INSENSITIVE = True


# Sets default for primary key IDs
# See https://docs.djangoproject.com/en/{{ docs_version }}/ref/models/fields/#bigautofield
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
2 changes: 2 additions & 0 deletions coderedcms/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,7 @@

SECRET_KEY = 'not needed'

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

NOSE_ARGS = ['--nocapture',
'--nologcapture', ]
4 changes: 4 additions & 0 deletions docs/releases/v0.21.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Upgrade considerations
* ``coderedcms.blocks.MultiSelectBlock`` has been removed and is now replaced
with ``wagtail.core.blocks.MultipleChoiceBlock``.

* CodeRed CMS now sets ``default_auto_field = 'django.db.models.AutoField'`` for
its own concrete models. If you had previously manually specified a different
``DEFAULT_AUTO_FIELD`` Django setting, you may need to create a migration.

* You may need to find/replace
``coderedcms.blocks.base_blocks.MultiSelectBlock`` with
``wagtail.core.blocks.MultipleChoiceBlock`` in any old migrations so that they
Expand Down
3 changes: 3 additions & 0 deletions tutorial/mysite/mysite/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,6 @@
# Tags

TAGGIT_CASE_INSENSITIVE = True


DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
2 changes: 1 addition & 1 deletion tutorial/mysite/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coderedcms==0.20.*
coderedcms==0.21.*

# django_sendmail_backend enables sending email from your web host server.
# Remove this if using a different email backend.
Expand Down
1 change: 1 addition & 0 deletions tutorial/mysite/website/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@


class WebsiteConfig(AppConfig):
default_auto_field = 'django.db.models.AutoField'
name = 'website'

0 comments on commit 01f605f

Please sign in to comment.