1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-23 14:59:36 +02:00

fix: Update URL path for user stats counts and remove email from response

This commit is contained in:
Sean Morley 2025-02-28 14:50:32 -05:00
parent 3c9aec4bfb
commit 4759ff71a1
2 changed files with 3 additions and 3 deletions

View file

@ -14,13 +14,13 @@ class StatsViewSet(viewsets.ViewSet):
"""
A simple ViewSet for listing the stats of a user.
"""
@action(detail=False, methods=['get'], url_path='counts/(?P<username>[^/.]+)')
@action(detail=False, methods=['get'], url_path='counts/(?P<username>[\w.@+-]+)')
def counts(self, request, username):
if request.user.username == username:
user = get_object_or_404(User, username=username)
else:
user = get_object_or_404(User, username=username, public_profile=True)
serializer = PublicUserSerializer(user)
# serializer = PublicUserSerializer(user)
# remove the email address from the response
user.email = None