How to solve autocomplete error "NoReverseMatch at /"? I am making django project can anybody help me

class Mobile(models.Model):
mobile_id = models.AutoField
mobile_name = models.CharField(max_length=100)

def autosuggest(request):
query_original = request.GET.get('term')
queryset = Mobile.objects.filter(mobile_name__icontains=query_original)

mylist += [x.mobile_name for x in queryset]
return JsonResponse(mylist,safe=False)

path("autosuggest/", views.autosuggest, name="Autosuggest"),


<link rel="stylesheet" href="//">
<script src=""></script>
<script src=""></script>

$( function() {

$( "#search" ).autocomplete({
  source: '{% url 'autosuggest' %}'
} );

I am also doing

source: '{% url 'my_app_name:autosuggest' %}'

in basic.html and in

app_name = 'my_app_name'

but it is not work. I am trying to href and another code but not working it show me NoReverseMatch at /. Reverse for 'autosuggest' not found. 'autosuggest' is not a valid view function or pattern name.

Read more here:

Content Attribution

This content was originally published by Nick Luv at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: