Не найдено обратного для 'car_details' с аргументами '('',)'. Испробован 1 шаблон(ы):
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
Повтор для 'car_details' с аргументами '('',)' не найден. Перепробован 1 шаблон(ы): и я попытался вызвать шаблоны в моих урлах в цикле, но мне выдает эту ошибку
.
для url имени car_details нужно передать id, а этот id (xxx) пуст в html теге
{% url "car_details" xxx %}