Created
April 15, 2019 19:27
-
-
Save jlaya/25f21c80bb3578702f73ec85a72ae900 to your computer and use it in GitHub Desktop.
Views.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def product_autocomplete(request): | |
q = request.GET.get('name') | |
if q: | |
obj = Product.objects.filter(model_reference__startswith=q) | |
leads_as_json = serializers.serialize('json', obj) | |
return HttpResponse(leads_as_json, content_type='json') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment