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 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...@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.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WYjj4ByDwcKWhdnwCU0039WW0frfG0qF715HqAONgi1eg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCc4Eoh9Hw%2BahTsyPdUhPbb_Lqx7dTJWcBA0uA4itFVKbQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6Wam0mbXeo9%3DbO7KK6%2BDvZ4A3SCA0NpL4TC_-0mksSoi0w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCfXXaoLkF7nxv2AKU9c%2B-FohcmLKZD_uSvmOPhB3MCqQg%40mail.gmail.com.