Answer the question
In order to leave comments, you need to log in
How to make a separate page for each product in django?
I have a test site:
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="home" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Список статьей</h1>
<div>
<img src="/media/photos/2021/10/06/e68cc68e-7b07-41c2-9520-4b315072a8a6_3Iwmjyw.jpg" width="100" height="100" alt="Test">
<h3><a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">Test</a></h3>
<div>Hello World!</div>
<p>Написано 6 октября 2021 г. 16:13</p>
</div>
<hr>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
# добавить путь в urls.py с ключем (к примеру lecture_id),
path('lections/<int:lecture_id>/', views.lections_detail, name='Curr_lecture'), # lecture_id
# views.py в представлении, которое вызывает этот путь, передавать этот ключ (названия должны быть идентичны)
def lections_detail(request, lecture_id): # lecture_id
lect = Lecture.objects.get(id=lecture_id)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question