ACCOUNT_EMAIL_REQUIRED and EMAIL_REQUIRED are deprecated as of allauth 65.5
Similar as https://github.com/iMerica/dj-rest-auth/issues/679 django-allauth refactored the settings to control which fields are required. Extract from the release notes:
Simplified signup form configuration. The following settings all controlled signup form:
ACCOUNT_EMAIL_REQUIRED,ACCOUNT_USERNAME_REQUIRED,ACCOUNT_SIGNUP_EMAIL_ENTER_TWICE,ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE. This setup had its issues. For example, when email was not required it was still available as an optional field, whereas the username field disappeared when not required. Also, for phone/SMS support, additional settings would have been required. The settings are now all deprecated, and replaced by one new setting:ACCOUNT_SIGNUP_FIELDS, which can be configured to e.g.['username*', 'email', 'password1*', 'password2*']to indicate which fields are present and required ('*'). This change is performed in a backwards compatible manner.
Here are the warnings I caught as emitted from dj-rest-auth:
/opt/.venv/lib/python3.12/site-packages/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,
/opt/.venv/lib/python3.12/site-packages/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)
I added a PR that might help with this: https://github.com/iMerica/dj-rest-auth/pull/686
+1
When can this be merged? Receiving warnings because of this
@iMerica there are hopes for a new release?
Temporary monkey patch example
NOTE: Test it before using in your codebase.
Add this to settings.py after allauth definitions:
# ....
from allauth.account import app_settings as allauth_account_settings
#...
# Bridge deprecated allauth flags for third-party packages (e.g. dj-rest-auth)
_signup_required_map = {
field.rstrip("*"): field.endswith("*") for field in ACCOUNT_SIGNUP_FIELDS
}
allauth_account_settings.USERNAME_REQUIRED = _signup_required_map.get(
"username", True
)
allauth_account_settings.EMAIL_REQUIRED = _signup_required_map.get(
"email", True
)
Versions I used:
django-allauth==65.7.0
dj-rest-auth==7.0.1