you'll just create an endpoint that receives a query parameter with the 
string to search for, and you'll search using 
YOURMODEL.objects.get(field=query_params.get("search_str"))

the frontend will be responsible for making the requests to search while 
typing
so, in your views.py you'll do something like this:



from rest_framework.views import APIView
from rest_framework.response import Response


from .models import YourModel


class Search(APIView):
    def get(self, request):
        search_str = request.query_params.get("search_str")
        results = YourModel.objects.get(field_to_search=search_str)
        return Response({"results": results})



you'll tie it to a route in urls.py file

and you're good to go


On Thursday, August 22, 2019 at 10:08:38 AM UTC+2, Soumen Khatua wrote:
>
> Hi Folks,
>
> I want to give some sequence of suggestion after type of any character(of 
> course if that character match any sequnce of string in database record) in 
> search query parameter, How I can do that by using Django Rest framework.
> Plase help me guys.
>
>
> Thank You
>
> Regards,
> Soumen
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6c4f40c-3a2f-4dfc-a310-8e7f17a79827%40googlegroups.com.

Reply via email to