Может ли кто-нибудь помочь мне выяснить, где я ошибся?
URL проекта
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('trips/',include('trips.urls')),
path('customers/',include('customers.urls')),
path('drivers/',include('drivers.urls')),
path('vehicles/',include('vehicles.urls')),
path('admin/', admin.site.urls),
]
urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
URL приложения
from django.urls import path
from . import views
urlpatterns = [
path('',views.customers, name='customers'),
path('<int:pk>/', views.customer_details, name='customer_details'),
]
Просмотр приложения
from django.shortcuts import render, get_object_or_404
from .models import *
# Create your views here.
def customers(request):
customers = Customer.objects.all().order_by('id')
return render(request, "customers.html", {'customers': customers, 'custactive': "active"})
def customer_details(request, pk):
customer = get_object_or_404(Customer, pk=pk)
return render(request, "/customer_details.html", {'customer': customer})
Как я звоню на страницу
<td><a href="{% url 'customer_details' pk=customer.pk %}">{{customer.name}}</a></td>
Я надеюсь вывести шаблон по адресу localhost / Customers / id
Помощь очень важна .