Hello,
I am building a webpage that lists template previews. When a user clicks a specific preview button, they should be directed to a detail page for that template. The URL configuration is defined in urls.py as follows:
urlpatterns = [path('choose_templates/<slug:slug>/', views.template_preview, name='template_preview'),]
In views.py, the view function is implemented like this:
def template_preview(request,slug):
context = {
'slug': slug
}
return render(request, './html/htmlbase.html', context)
And in htmlbase.html, I attempt to dynamically include a template based on the slug:
<!DOCTYPE html>
<html>
<head></head>
<body>
{% include slug %}
</body>
</html>
However, clicking on different template preview buttons results in a "TemplateDoesNotExist" error. What modifications can I make to dynamically include the correct template using the slug?