The SIO2 project
  1. The SIO2 project
  2. SIO-2501

Auto-created primary key used when not defining a primary key type warning

    Details

      Description

      Because of the change in Django 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.

      To avoid unwanted migrations in the future, configure it on a per-app basis by adding default_auto_field = 'django.db.models.AutoField' in all AppConfig classes.

        Activity

        Hide
        Gerrit Gerrit added a comment -
        Change oioioi~master~Ibc19cc9a2db265391dae3646c6ec82b48356e246, patchset 1
        https://gerrit.sio2project.mimuw.edu.pl/3824

        SIO-2501 Auto-created primary key used when not defining a primary key type warningi Attribute default_auto_field = 'django.db.models.AutoField' to point to a subclass of AutoField added in all classes that inherit from AppConfig.

        Change-Id: Ibc19cc9a2db265391dae3646c6ec82b48356e246
        Show
        Gerrit Gerrit added a comment - Change oioioi~master~Ibc19cc9a2db265391dae3646c6ec82b48356e246, patchset 1 https://gerrit.sio2project.mimuw.edu.pl/3824 SIO-2501 Auto-created primary key used when not defining a primary key type warningi Attribute default_auto_field = 'django.db.models.AutoField' to point to a subclass of AutoField added in all classes that inherit from AppConfig. Change-Id: Ibc19cc9a2db265391dae3646c6ec82b48356e246
        Hide
        Gerrit Gerrit added a comment -
        Change oioioi~master~Ibc19cc9a2db265391dae3646c6ec82b48356e246, patchset 2
        https://gerrit.sio2project.mimuw.edu.pl/3824

        SIO-2501 Auto-created primary key used when not defining a primary key type warningi Attribute default_auto_field = 'django.db.models.AutoField' to point to a subclass of AutoField added in all classes that inherit from AppConfig.

        Change-Id: Ibc19cc9a2db265391dae3646c6ec82b48356e246
        Show
        Gerrit Gerrit added a comment - Change oioioi~master~Ibc19cc9a2db265391dae3646c6ec82b48356e246, patchset 2 https://gerrit.sio2project.mimuw.edu.pl/3824 SIO-2501 Auto-created primary key used when not defining a primary key type warningi Attribute default_auto_field = 'django.db.models.AutoField' to point to a subclass of AutoField added in all classes that inherit from AppConfig. Change-Id: Ibc19cc9a2db265391dae3646c6ec82b48356e246
        Hide
        Gerrit Gerrit added a comment -
        Change oioioi~master~Ibc19cc9a2db265391dae3646c6ec82b48356e246, patchset 3
        https://gerrit.sio2project.mimuw.edu.pl/3824

        SIO-2501 Auto-created primary key used when not defining a primary key type warningi Attribute default_auto_field = 'django.db.models.AutoField' to point to a subclass of AutoField added in all classes that inherit from AppConfig.

        Change-Id: Ibc19cc9a2db265391dae3646c6ec82b48356e246
        Show
        Gerrit Gerrit added a comment - Change oioioi~master~Ibc19cc9a2db265391dae3646c6ec82b48356e246, patchset 3 https://gerrit.sio2project.mimuw.edu.pl/3824 SIO-2501 Auto-created primary key used when not defining a primary key type warningi Attribute default_auto_field = 'django.db.models.AutoField' to point to a subclass of AutoField added in all classes that inherit from AppConfig. Change-Id: Ibc19cc9a2db265391dae3646c6ec82b48356e246

          People

          • Assignee:
            Tomasz WaleĊ„
            Reporter:
            Joanna Wojciechowska
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: