Answer the question
In order to leave comments, you need to log in
Through the include tag I connect the template and information from the database is not displayed, everything works with static files, what's wrong?
I'm just starting to learn django and for sure this problem is insignificant, but I can't figure it out myself
. First time I'm writing here, maybe I don't know what rules, don't water too much)
views.py
def slider1(request):
slider_list = slider.objects.all()
return render(request, 'media1/slider.html', {'slider_list': slider_list,
})
{% load static %}
<section class="section background-dark">
{% for sl in slider_list %}
<div class="line">
<div class="carousel-fade-transition owl-carousel carousel-main carousel-nav-white carousel-wide-arrows">
<div class="item">
<div class="s-12 center">
<img src="{{ sl.image.url }}" alt="">
<div class="carousel-content">
<div class="padding-2x">
<div class="s-12 m-12 l-8">
<p class="text-white text-s-size-20 text-m-size-40 text-l-size-60 margin-bottom-40 text-thin text-line-height-1">
{{ sl.title }}</p>
<p class="text-white text-size-16 margin-bottom-30">{{ sl.text }}</p>
</div>
</div>
</div>
</div>
</div>{% endfor %}
</section>
{% extends 'base.html' %}
{% load static %}
{% block content %}
{% include 'media1/slider.html' %}
{% endblock %}
Answer the question
In order to leave comments, you need to log in
And where do you think the data for the slider in index.html will come from?
Code that renders index.html where?..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question