На главной странице отображаются посты (post_go), которые добавляются из админки. Нужно на этой же странице сделать возможность менять текст слайдера (full_slider) из админки.
У меня не полностью получилось реализовать,
помогите пожалуйста.
Получается настраиваю маршрутизацию, вывожу на страницу посты (post_go), в этом же шаблоне я includ'ом вставляю файл slider.html. Слайдер появляется на странице, но не появляется текст из админки.
urls.py
urlpatterns = [
url(r'^$', views.post_go),
]
views.py
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)
slider.html
{% 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 %}