|
9 | 9 | from rest_framework import status
|
10 | 10 | from rest_framework.views import APIView
|
11 | 11 | from rest_framework.response import Response
|
12 |
| -from rest_framework.generics import GenericAPIView |
| 12 | +from rest_framework.generics import GenericAPIView, RetrieveUpdateAPIView |
13 | 13 | from rest_framework.permissions import IsAuthenticated, AllowAny
|
14 |
| -from rest_framework.generics import RetrieveUpdateAPIView |
15 | 14 |
|
16 | 15 | if 'allauth' in settings.INSTALLED_APPS:
|
17 | 16 | from allauth.account import app_settings as allauth_settings
|
|
22 | 21 | PasswordChangeSerializer, JWTSerializer, create_token
|
23 | 22 | )
|
24 | 23 | from .models import TokenModel
|
25 |
| - |
26 | 24 | from .utils import jwt_encode
|
27 | 25 |
|
28 | 26 |
|
@@ -123,13 +121,14 @@ def logout(self, request):
|
123 | 121 |
|
124 | 122 | class UserDetailsView(RetrieveUpdateAPIView):
|
125 | 123 | """
|
126 |
| - Returns User's details in JSON format. |
| 124 | + Reads and updates UserModel fields |
| 125 | + Accepts GET, PUT, PATCH methods. |
| 126 | +
|
| 127 | + Default accepted fields: username, first_name, last_name |
| 128 | + Default display fields: pk, username, email, first_name, last_name |
| 129 | + Read-only fields: pk, email |
127 | 130 |
|
128 |
| - Accepts the following GET parameters: token |
129 |
| - Accepts the following POST parameters: |
130 |
| - Required: token |
131 |
| - Optional: email, first_name, last_name and UserProfile fields |
132 |
| - Returns the updated UserProfile and/or User object. |
| 131 | + Returns UserModel fields. |
133 | 132 | """
|
134 | 133 | serializer_class = UserDetailsSerializer
|
135 | 134 | permission_classes = (IsAuthenticated,)
|
|
0 commit comments