Reverse for 'car_details' with keyword arguments '{'id': ''}' not found. 1 pattern(s) tried: ['cars(?P<id>[0-9]+)/car_details\\Z']

In urls.py urlpatterns = [ path('', views.cars, name='cars'),
path('int:id/car_details', views.car_details, name='car_details'), ] In views.py def car_details(request, id): single_car = get_object_or_404(Car, pk=id), id = 1 data = { 'single_car': single_car, # 'url': url, } reverse('single_car', args=(id))

return render(request, 'cars/car_details.html', data) In templates { %for car in cars %}

{{car.car_title}} {{car.state}}, {{car.city}}

endfor %} I also tried with reverse function it doesnot works get an same error

tried with reverse function in views.py it doesnot works get an same error

Back to Top