Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion streamx-api/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Meta:
verbose_name_plural = _("users")

def __str__(self):
return "@" + self.username
return f"@{self.username}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function User.__str__ refactored with the following changes:


def is_mod(self):
return self.is_staff
Expand Down
3 changes: 1 addition & 2 deletions streamx-api/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class UserSearchView(generics.ListAPIView):
permission_classes = [permissions.AllowAny]

def get_queryset(self):
query = self.request.query_params.get('q', '')
if query:
if query := self.request.query_params.get('q', ''):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserSearchView.get_queryset refactored with the following changes:

return User.objects.filter(username__icontains=query)
else:
return User.objects.none()