Answer the question
In order to leave comments, you need to log in
How to display values from the database entered in the django admin?
The main page displays posts (post_go) that are added from the admin panel. It is necessary on the same page to make it possible to change the text of the slider (full_slider) from the admin panel.
I didn't manage to complete it, please help me .
It turns out I'm setting up routing, displaying posts on the page (post_go), in the same template I insert the slider.html file includ. The slider appears on the page, but the text from the admin panel does not appear.
urls.py
urlpatterns = [
url(r'^$', views.post_go),
]
def post_go(request):
all_post = posts.objects.all().order_by("-date")[:18]
context = {"post_objects" : all_post}
return render(request, "pages/post.html", context)
def full_slider(request):
all_slider = slider.objects.all()
context1 = {"slide" : all_slider}
return render(request, "pages/slider.html", context1)
{% block content %}
{% load static %}
{% for obj in slide %}
<div class="hero-slider">
<div class="hero-slider__carousel js-hero-carousel">
<div class="hero-slider__unit" style="background-image: url({% static '/pages/imagecache/00/000011_orig.jpg' %});">
<div class="hero-slider__content">
<h3 class="hero-slider__title">
<p style="font-size:60px">{{obj.title1}}</p>
</h3>
<span class="hero-slider__stripe">{{obj.descript1}}</span>
</div>
</div>
<div class="hero-slider__unit" style="background-image: url({% static '/pages/imagecache/00/000007_orig.jpg' %});">
<div class="hero-slider__content">
<h3 class="hero-slider__title">Удивительный Тайланд для Вашей семьи</h3>
<span class="hero-slider__stripe">От 1766$ на 1-го человека</span>
</div>
</div>
<div class="hero-slider__unit" style="background-image: url({% static '/pages/imagecache/00/000008_orig.jpg' %});">
<div class="hero-slider__content">
<h3 class="hero-slider__title">12 дней рая<br>Гранд Тур по Европе</h3>
<span class="hero-slider__stripe">От 1915 евро на двоих</span>
</div>
</div>
<div class="hero-slider__unit" style="background-image: url({% static '/pages/imagecache/00/000015_orig.jpg' %});">
<div class="hero-slider__content">
<h3 class="hero-slider__title">Каникулы<br>в Нью-Йорке</h3>
<span class="hero-slider__stripe">от 2017$ с одного человека</span>
</div>
</div>
<div class="hero-slider__unit" style="background-image: url({% static '/pages/imagecache/00/000016_orig.jpg' %});">
<div class="hero-slider__content">
<h3 class="hero-slider__title">Роскошь Арабских Эмиратов</h3>
<span class="hero-slider__stripe">от 635$ с человека</span>
</div>
</div>
</div>
<div class="hero-slider__dots"></div>
</div>
{% endfor %}
{% endblock %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question