detail.html
urls.py |
urlpatterns = [ path(‘detail/<int:pk>’, views.Detail.as_view(), name=’detail’),] |
views.py |
from django.views import genericclass Detail(generic.DetailView): model = App template_name = ‘app/detail.html’ def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) return context |
detail.html |
{{ app.title }}{{ app.text | safe }} |
index.html |
<a href=”{% url ‘app:detail’ app.id %}”> <img src=”{{ app.image.url }}”></a><a href=”{% rul ‘app:detail’ app.id %}”> {{ app.title }}</a> |