Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #32367 -- Fixed system check for specifying type of auto-created primary keys for inherited PKs. #13925

Merged
merged 1 commit into from Jan 21, 2021

Conversation

felixxm
Copy link
Member

@felixxm felixxm commented Jan 21, 2021

ticket-32367

Alternative to #13922.

Regression in b5e12d4.

Thanks אורי for the report.

…d primary keys for inherited PKs.

Regression in b5e12d4.

Thanks אורי for the report.
@felixxm
Copy link
Member Author

felixxm commented Jan 21, 2021

@uri-rodberg Can you check your app with this patch?

@uri-rodberg
Copy link
Contributor

@uri-rodberg Can you check your app with this patch?

Yes, sure. Can you give me a link to install this Django version with pip?

@felixxm
Copy link
Member Author

felixxm commented Jan 21, 2021

@uri-rodberg Can you check your app with this patch?

Yes, sure. Can you give me a link to install this Django version with pip?

Thanks, pip install git+https://github.com/django/django.git@refs/pull/13925/head should work.

@uri-rodberg
Copy link
Contributor

uri-rodberg commented Jan 21, 2021

@uri-rodberg Can you check your app with this patch?

Yes, sure. Can you give me a link to install this Django version with pip?

Thanks, pip install git+https://github.com/django/django.git@refs/pull/13925/head should work.

It looks like this installed Django 4.0.

$ pip install git+https://github.com/django/django.git@refs/pull/13925/head
Collecting git+https://github.com/django/django.git@refs/pull/13925/head
  Cloning https://github.com/django/django.git (to revision refs/pull/13925/head) to c:\users\....
  WARNING: Did not find branch or tag 'refs/pull/13925/head', assuming revision or ref.
Requirement already satisfied: asgiref>=3.2.10 in ....venv_3.6\lib\site-packages (from Django==4.0.dev20210121080307) (3.3.1)
Requirement already satisfied: pytz in ....venv_3.6\lib\site-packages (from Django==4.0.dev20210121080307) (2020.5)
Requirement already satisfied: sqlparse>=0.2.2 in ....venv_3.6\lib\site-packages (from Django==4.0.dev20210121080307) (0.4.1)
Building wheels for collected packages: Django
  Building wheel for Django (setup.py): started
  Building wheel for Django (setup.py): finished with status 'done'
  Created wheel for Django: filename=Django-4.0.dev20210121080307-py3-none-any.whl size=7887012 sha256=0823f9b6453ecf5d4365026539c2ec0ea1ce78963e551757aa0e0c913c15a92f
  Stored in directory: C:\Users\....
Successfully built Django
Installing collected packages: Django
Successfully installed Django-4.0.dev20210121080307

@felixxm
Copy link
Member Author

felixxm commented Jan 21, 2021

Yes because this branch is based on master, I can create a branch based on stable/3.2.x if you want.

@uri-rodberg
Copy link
Contributor

Yes because this branch is based on master, I can create a branch based on stable/3.2.x if you want.

Yes, please do.

@felixxm
Copy link
Member Author

felixxm commented Jan 21, 2021

Yes because this branch is based on master, I can create a branch based on stable/3.2.x if you want.

Yes, please do.

pip install git+https://github.com/felixxm/django.git@3.2-issue-32367

Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, yes. 👍

Thanks for testing @uri-rodberg! 🥇

Copy link
Member

@hramezani hramezani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@uri-rodberg
Copy link
Contributor

uri-rodberg commented Jan 21, 2021

pip install git+https://github.com/felixxm/django.git@3.2-issue-32367

It looks like this version doesn't raise models.W042 for the models which inherit their primary keys, which was raised by 3.2 alpha. It does raise models.W042 for models which use the default primary key, which I understand is expected.

System check identified some issues:

WARNINGS:
blocks.Block: (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 AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
contact_by_form.Feedback: (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 SpeedyCoreContactByFormConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
core_messages.ReadMark: (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 SpeedyCoreMessagesConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
friendship.Block: (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 AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
friendship.Follow: (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 AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
friendship.Friend: (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 AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
friendship.FriendshipRequest: (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 AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
likes.UserLike: (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 AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

@felixxm
Copy link
Member Author

felixxm commented Jan 21, 2021

.... which I understand is expected.

Yes it is, thanks for checking 👍

@uri-rodberg
Copy link
Contributor

If I add the line DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' to my settings, new migrations are created and no warnings are raised after adding this line.

@felixxm felixxm merged commit a03a361 into django:master Jan 21, 2021
@felixxm felixxm deleted the issue-32367 branch January 21, 2021 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants