Skip to content

feat: add compatibility with django-allauth v65.4#681

Merged
iMerica merged 1 commit into
iMerica:masterfrom
browniebroke:feat/allauth-65.4-compat
Sep 13, 2025
Merged

feat: add compatibility with django-allauth v65.4#681
iMerica merged 1 commit into
iMerica:masterfrom
browniebroke:feat/allauth-65.4-compat

Conversation

@browniebroke
Copy link
Copy Markdown
Contributor

@browniebroke browniebroke commented Feb 24, 2025

  • Prefer the new LOGIN_METHODS when available
  • Fallback to AUTHENTICATION_METHOD. Should keep dj-rest-auth working with older allauth versions
  • Once dj-rest-auth wants to drop support for django-allauth < 65.4:
    • Remove the branches with AUTHENTICATION_METHOD
    • Update the minimum allauth version in setup.py (and docs, if needed)

Fix #679

@sipa-echo-zaoa
Copy link
Copy Markdown

Hi @iMerica,
Could you please merge this PR?
Getting these warning messages every time a command is run is getting pretty annoying.
Thank you.

@evdutt
Copy link
Copy Markdown

evdutt commented Jun 26, 2025

@iMerica Can you please take a look at this PR so I can stop getting warnings? Thanks!

In the meantime, I added the following to my settings to suppress this.

import warnings

warnings.filterwarnings(
'ignore',
message='app_settings.AUTHENTICATION_METHOD is deprecated, use: app_settings.LOGIN_METHODS',
category=UserWarning,
module='dj_rest_auth.serializers'
)

@onny
Copy link
Copy Markdown

onny commented Jul 4, 2025

Trying to use this with django-allauth 65.9 I get this error while running tests

       > ======================================================================
       > ERROR [0.001s]: dj_rest_auth.tests.test_social (unittest.loader._FailedTest.dj_rest_auth.tests.test_social)
       > ----------------------------------------------------------------------
       > ImportError: Failed to import test module: dj_rest_auth.tests.test_social
       > Traceback (most recent call last):
       >   File "/nix/store/sd81bvmch7njdpwx3lkjslixcbj5mivz-python3-3.13.4/lib/python3.13/unittest/loader.py", line 396, in _find_test_path
       >     module = self._get_module_from_name(name)
       >   File "/nix/store/sd81bvmch7njdpwx3lkjslixcbj5mivz-python3-3.13.4/lib/python3.13/unittest/loader.py", line 339, in _get_module_from_name
       >     __import__(name)
       >     ~~~~~~~~~~^^^^^^
       >   File "/build/source/dj_rest_auth/tests/test_social.py", line 5, in <module>
       >     from allauth.socialaccount.providers.facebook.provider import GRAPH_API_URL
       > ImportError: cannot import name 'GRAPH_API_URL' from 'allauth.socialaccount.providers.facebook.provider' (/nix/store/crzcnj72srj6wb0ar5r2w0hcs04jhpsx-python3.13-django-allauth-65.9.0/lib/python3.13/site-packages/allauth/socialaccount/providers/facebook/provider.py)
       >
       >
       > ----------------------------------------------------------------------
       > Ran 59 tests in 68.187s
       >
       > FAILED (errors=1)

@iMerica iMerica merged commit c634203 into iMerica:master Sep 13, 2025
@browniebroke browniebroke deleted the feat/allauth-65.4-compat branch September 13, 2025 20:14
@ratmat2002
Copy link
Copy Markdown

This PR doesn't appear to provide a fixed solution. No updates were made to the registration/serializers.py file which is still generating these deprecated settings warnings:

dj_rest_auth/registration/serializers.py:228: UserWarning: app_settings.USERNAME_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['username']['required']
required=allauth_account_settings.USERNAME_REQUIRED,

dj_rest_auth/registration/serializers.py:230: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)

dj_rest_auth/registration/serializers.py:288: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)

@browniebroke
Copy link
Copy Markdown
Contributor Author

browniebroke commented Sep 16, 2025

This PR doesn't appear to provide a fixed solution. No updates were made to the registration/serializers.py file which is still generating these deprecated settings warnings:

dj_rest_auth/registration/serializers.py:228: UserWarning: app_settings.USERNAME_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['username']['required'] required=allauth_account_settings.USERNAME_REQUIRED,

dj_rest_auth/registration/serializers.py:230: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required'] email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)

dj_rest_auth/registration/serializers.py:288: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required'] email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)

These are tracked in a separate issue and pull request:

They were introduced in a different version of django-allauth (65.5), after this fix was submitted. This fix only handles incompatibilities for v65.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AUTHENTICATION_METHOD is deprecated as of allauth v65.4

6 participants