pennersr / django-allauth

Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.
https://allauth.org
MIT License
9.51k stars 3.03k forks source link

Migration with Django 3.2.9 and DEFAULT_AUTO_FIELD #2971

Closed TobitRE closed 2 years ago

TobitRE commented 2 years ago

Hi,

i create a new Django project from scratch with Django 3.2.9 and DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'.

Now I was running ./manange.py make migrations and get

Migrations for 'socialaccount':
  /XXX/venv/lib/python3.9/site-packages/allauth/socialaccount/migrations/0004_auto_20211109_2123.py
    - Alter field id on socialaccount
    - Alter field id on socialapp
    - Alter field id on socialtoken

Is this a bug or a feature?

mpoli commented 2 years ago

The 0.45.0 release does not support django 3.2.

I have been using 3.2 with the latest commit https://github.com/pennersr/django-allauth/commit/36dd5a7dad52429143434517c50811927283e0bb and that problem is solved.

You need to reference that commit in your requirements.txt while we wait for the next release (probably 0.46.0) to be able to use django 3.2 and django-allauth, like this:

git+https://github.com/pennersr/django-allauth@36dd5a7 # django-allauth

Edit: Version 0.46.0 has been released with support to Django 3.2. Please re-check once you upgrade and that problem should be gone.

1oglop1 commented 2 years ago

@mpoli Thank you for your comment! I just monkey patched the Allauth app config in manage.py until dj-rest-auth is updated.

from allauth.account.apps import AccountConfig
AccountConfig.default_auto_field = "django.db.models.AutoField"
mpoli commented 2 years ago

Just to clarify, this is not/was not a bug. Nor a feature.

This was an error that happened due to a breaking change in Django 3.2 (in relation to Django 3.1). So Django 3.2 is now supported by django-allauth since release 0.46.0, as mentioned in https://github.com/pennersr/django-allauth/issues/2976.

Upgrading django-allauth to release 0.46.0 should automatically solve this AutoField ghost in manage.py makemigrations, but a manage.py migrate might be necessary to get all changes in the database.

A number of other Django apps are still held in Django 3.1 due to this particular breaking change in 3.2.

thiagoferreiraw commented 2 years ago

Thanks for the explanation @mpoli!

I updated to 0.46.0 and everything's back to normal. Thanks!