Skip to content

Commit e450d80

Browse files
Fix: Import Profile model in account views
Resolves NameError: name 'Profile' is not defined by importing the Profile model in account/views.py.
1 parent 9bcb47b commit e450d80

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

account/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
TokenVerifyView as BaseTokenVerifyView, TokenBlacklistView,
1515
)
1616

17+
from .models import Profile
1718
from .serializers import UserProfileSerializer, RefreshTokenSerializer
1819

1920
logger = getLogger(__name__)

backend.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2025-06-29 16:27:38.949 | Error during profile management: name 'Profile' is not defined
2+
2025-06-29 16:27:38.949 | Traceback (most recent call last):
3+
2025-06-29 16:27:38.949 | File "/code/account/views.py", line 74, in me
4+
2025-06-29 16:27:38.949 | profile, created = Profile.objects.get_or_create(user=request.user)
5+
2025-06-29 16:27:38.949 | ^^^^^^^
6+
2025-06-29 16:27:38.949 | NameError: name 'Profile' is not defined
7+
2025-06-29 16:27:38.954 | Internal server error occurred
8+
2025-06-29 16:27:38.954 | Traceback (most recent call last):
9+
2025-06-29 16:27:38.954 | File "/usr/local/lib/python3.13/site-packages/rest_framework/views.py", line 512, in dispatch
10+
2025-06-29 16:27:38.954 | response = handler(request, *args, **kwargs)
11+
2025-06-29 16:27:38.954 | File "/code/account/views.py", line 74, in me
12+
2025-06-29 16:27:38.954 | profile, created = Profile.objects.get_or_create(user=request.user)
13+
2025-06-29 16:27:38.954 | ^^^^^^^
14+
2025-06-29 16:27:38.954 | NameError: name 'Profile' is not defined
15+
2025-06-29 16:27:38.954 | Internal Server Error: /auth/me/
16+
2025-06-29 16:27:38.955 | [pid: 20|app: 0|req: 5/5] 172.18.0.1 () {52 vars in 1214 bytes} [Sun Jun 29 13:27:38 2025] GET /auth/me/ => generated 51 bytes in 29 msecs (HTTP/1.1 500) 8 headers in 286 bytes (1 switches on core 0)

0 commit comments

Comments
 (0)