Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Commit 07c1ddc

Browse files
PLAT-11505 Migrate from django-rest-auth to dj-rest-auth (#626)
* chore(Pipfile): remove django-rest-auth package feat(Pipfile): add dj-rest-auth package for authentication and authorization functionality * fix(serializers.py): import PasswordResetSerializer from dj_rest_auth instead of rest_auth fix(settings.py): update third-party app names to use dj_rest_auth instead of rest_auth fix(settings.py): update REST_AUTH settings to use REST_AUTH instead of REST_AUTH_SERIALIZERS and REST_AUTH_REGISTER_SERIALIZERS fix(urls.py): update rest_auth urls to use dj_rest_auth instead of rest_auth feat(urls.py): update rest_auth.registration urls to use dj_rest_auth.registration instead of rest_auth.registration * chore(Pipfile): update dj-rest-auth version to 4.0.1 for compatibility reasons
1 parent 8682fe5 commit 07c1ddc

File tree

5 files changed

+29
-30
lines changed

5 files changed

+29
-30
lines changed

{{cookiecutter.project_slug}}/Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ whitenoise = "~=6.0.0"
2020
djangorestframework = "~=3.14.0"
2121
django-bootstrap4 = "~=22.1"
2222
django-allauth = "~=0.54.0"
23-
django-rest-auth = "~=0.9.5"
24-
django-extensions = "~=3.2.3"
23+
django-extensions = "~=3.1.5"
2524
packaging = "*"
2625
pyyaml = "~=6.0"
2726
pillow = "~=10.0.1"
@@ -33,3 +32,4 @@ google-cloud-storage = "==2.9.0"
3332
pipenv = "*"
3433
django-import-export = "*"
3534
drf-spectacular = "~=0.26.4"
35+
dj-rest-auth = "==4.0.1"

{{cookiecutter.project_slug}}/Pipfile.lock

Lines changed: 21 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

{{cookiecutter.project_slug}}/home/api/v1/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from allauth.account.adapter import get_adapter
88
from allauth.account.utils import setup_user_email
99
from rest_framework import serializers
10-
from rest_auth.serializers import PasswordResetSerializer
10+
from dj_rest_auth.serializers import PasswordResetSerializer
1111

1212

1313
User = get_user_model()

{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/settings.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
THIRD_PARTY_APPS = [
7878
'rest_framework',
7979
'rest_framework.authtoken',
80-
'rest_auth',
81-
'rest_auth.registration',
80+
'dj_rest_auth',
81+
'dj_rest_auth.registration',
8282
'bootstrap4',
8383
'allauth',
8484
'allauth.account',
@@ -202,11 +202,9 @@
202202
ACCOUNT_ALLOW_REGISTRATION = env.bool("ACCOUNT_ALLOW_REGISTRATION", True)
203203
SOCIALACCOUNT_ALLOW_REGISTRATION = env.bool("SOCIALACCOUNT_ALLOW_REGISTRATION", True)
204204

205-
REST_AUTH_SERIALIZERS = {
205+
REST_AUTH = {
206206
# Replace password reset serializer to fix 500 error
207207
"PASSWORD_RESET_SERIALIZER": "home.api.v1.serializers.PasswordSerializer",
208-
}
209-
REST_AUTH_REGISTER_SERIALIZERS = {
210208
# Use custom serializer that has no username and matches web signup
211209
"REGISTER_SERIALIZER": "home.api.v1.serializers.SignupSerializer",
212210
}

{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
path("api/v1/", include("home.api.v1.urls")),
2929
path("admin/", admin.site.urls),
3030
path("users/", include("users.urls", namespace="users")),
31-
path("rest-auth/", include("rest_auth.urls")),
31+
path("rest-auth/", include("dj_rest_auth.urls")),
3232
# Override email confirm to use allauth's HTML view instead of rest_auth's API view
3333
path("rest-auth/registration/account-confirm-email/<str:key>/", confirm_email),
34-
path("rest-auth/registration/", include("rest_auth.registration.urls")),
34+
path("rest-auth/registration/", include("dj_rest_auth.registration.urls")),
3535
]
3636

3737
admin.site.site_header = "{{cookiecutter.project_name}}"

0 commit comments

Comments
 (0)