Django using include with a dynamic view does not work
I created a view that allows me to have a dynamic slider and I render it in an html file called slider. i have a main page called test where i include this slider file, the problem is it doesn't render anything for me,it's like it doesn't see my slider view and therefore nothing is rendered, but the file is included anyway.
someone can make me understand why and would you give me a hand to solve this problem?
views
class SlideListView(ListView):
model = Slide
template_name = 'slider.html'
context_object_name = 'slides'
def get_queryset(self):
queryset = Slide.objects.all().order_by(F('ordine').asc(nulls_last=True)) #ordine con None a fine slider
return queryset
url
path('', TemplateView.as_view(template_name="test.html")),
html iclude
<section class="container mt-3">
<div class="d-flex align-items-center justify-content-between">
<h1 class="nome-scheda">SLIDER</h1>
<a href="{% url 'bo_slider' %}" class="btn btn-outline-primary">VARIE SLIDE</a>
</div>
<hr>
<div class="row justify-content-center mt-5">
<div class="col-lg-6">
<div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
{% for slide in slides %}
{% if slide.attivo == True %} <!--se lo switch è on mostro la slide-->
<!--aggiungo classe active alla prima in modo da farlo partire-->
<div class="carousel-item {% if forloop.first %} active {% endif %}">
<img src="{{ slide.immagine.url }}" class="d-block w-100">
{% if forloop.first %} <!--alla prima slide metto il tag h1-->
<h1>{{ slide.titolo }}</h1>
{% else %}
<h2>{{ slide.titolo }}</h2>
{% endif %}
<p>{{ slide.descrizione }}</p>
<a href="{{ slide.bottone_link }}" class="btn btn-danger">{{ slide.bottone }}</a>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
</section>
html page
{% extends "base.html" %}
{% block content %}
<section class="container mt-5">
<h3 class="text-uppercase">test slider import</h3>
<hr>
{% include 'slider.html' %}
</section>
{% endblock content %}