updated new username feature to api app; restructured api urlpatterns for more sustainable pahts
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -2,8 +2,9 @@ from django.shortcuts import get_object_or_404
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
|
||||
from apps.api.serializers import ItemSerializer, ListSerializer, UserSerializer
|
||||
from apps.dashboard.models import Item, List
|
||||
from apps.api.serializers import ItemSerializer, ListSerializer
|
||||
from apps.lyric.models import User
|
||||
|
||||
|
||||
class ListDetailAPI(APIView):
|
||||
@@ -32,3 +33,13 @@ class ListsAPI(APIView):
|
||||
item = Item.objects.create(text=request.data.get("text", ""), list=list_)
|
||||
serializer = ListSerializer(list_)
|
||||
return Response(serializer.data, status=201)
|
||||
|
||||
class UserSearchAPI(APIView):
|
||||
def get(self, request):
|
||||
q = request.query_params.get("q", "")
|
||||
users = User.objects.filter(
|
||||
username__icontains=q,
|
||||
searchable=True,
|
||||
)
|
||||
serializer = UserSerializer(users, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
Reference in New Issue
Block a user