#32741: Tutorial Part 2 throws models.W042 warnings when making migrations
------------------------------------------------+------------------------
               Reporter:  Katie McLaughlin      |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Documentation         |        Version:  3.2
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  1
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 Changes in Django 2.2 mean that the auto-created primary key changes
 (https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-
 auto-created-primary-keys) throw the associated warnings, as the Tutorial
 Part 2 doesn't adjust for these.

 Reproduction:

  * in a new virtualenv, `pip install django==3.2.2`
  * generate a new template project `django-admin startproject mysite .`
    * confirm the generated `settings.py` doesn't mention
 DEFAULT_AUTO_FIELD
  * run though the tutorial, up to and including
 https://docs.djangoproject.com/en/3.2/intro/tutorial02/#creating-models
  * attempt to `python manage.py makemigrations polls`
  * get errors

 {{{
 System check identified some issues:

 WARNINGS:
 polls.Choice: (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
 PollsConfig.default_auto_field attribute to point to a subclass of
 AutoField, e.g. 'django.db.models.BigAutoField'.
 polls.Question: (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
 PollsConfig.default_auto_field attribute to point to a subclass of
 AutoField, e.g. 'django.db.models.BigAutoField'.
 Migrations for 'polls':
   polls/migrations/0001_initial.py
     - Create model Question
     - Create model Choice
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32741>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.dd0e003a4496f41b0be051b576a2db36%40djangoproject.com.

Reply via email to