Reverse for 'car_details' with arguments '('',)' not found. 1 pattern(s) tried:
In Views.py def car_details(request, id): redirect_to=1 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 urls.py of my app urlpatterns = \[ path('', views.cars, name='cars'), path('\<int:id\>/car_details', views.car_details, name='car_details'), \] and In my templates cars.html for car in cars %}`your text` <h1> <a href="{% url ">{{car.car_title}}</a> </h1> <a href="{% url "> {{car.state}}, {{car.city}} </a> endfor %} when i tried to call this car_details.html with urls function it show me this error Reverse for 'car_details' with arguments '('',)' not found. 1 pattern(s) tried: I also tried with reverse function it doesnot work,How can I solve this error in models.py class Car(models.Model): id=models.IntegerField(primary_key=True,default=True) def __str__(self): return self.car_title
Reverse for 'car_details' with arguments '('',)' not found. 1 pattern(s) tried: and I tried to call the Templates in my urls in a loop but shows me this error
for the url name car_details you need to pass the id and that id (xxx) is empty in the html tag
{% url "car_details" xxx %}