mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-25 07:49:37 +02:00
feat: Add disable_password field to CustomUserDetailsSerializer and update PublicUserListView
This commit is contained in:
parent
3b6d437f29
commit
585f050a30
2 changed files with 3 additions and 2 deletions
|
@ -96,7 +96,7 @@ class CustomUserDetailsSerializer(UserDetailsSerializer):
|
||||||
|
|
||||||
class Meta(UserDetailsSerializer.Meta):
|
class Meta(UserDetailsSerializer.Meta):
|
||||||
model = CustomUser
|
model = CustomUser
|
||||||
fields = UserDetailsSerializer.Meta.fields + ['profile_pic', 'uuid', 'public_profile', 'has_password']
|
fields = UserDetailsSerializer.Meta.fields + ['profile_pic', 'uuid', 'public_profile', 'has_password', 'disable_password']
|
||||||
read_only_fields = UserDetailsSerializer.Meta.read_only_fields + ('uuid', 'has_password', 'disable_password')
|
read_only_fields = UserDetailsSerializer.Meta.read_only_fields + ('uuid', 'has_password', 'disable_password')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -122,5 +122,5 @@ class CustomUserDetailsSerializer(UserDetailsSerializer):
|
||||||
representation.pop('pk', None)
|
representation.pop('pk', None)
|
||||||
# Remove the email field
|
# Remove the email field
|
||||||
representation.pop('email', None)
|
representation.pop('email', None)
|
||||||
|
|
||||||
return representation
|
return representation
|
||||||
|
|
|
@ -72,6 +72,7 @@ class PublicUserListView(APIView):
|
||||||
# for every user, remove the field has_password
|
# for every user, remove the field has_password
|
||||||
for user in serializer.data:
|
for user in serializer.data:
|
||||||
user.pop('has_password', None)
|
user.pop('has_password', None)
|
||||||
|
user.pop('disable_password', None)
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
class PublicUserDetailView(APIView):
|
class PublicUserDetailView(APIView):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue