8 changed files with 62 additions and 2 deletions
@ -0,0 +1,36 @@ |
|||||
|
{% for banner in bannery %} |
||||
|
{{ banner.popisek }} |
||||
|
<img src="/media/{{ banner.obrazek }}" alt=""> |
||||
|
{% endfor %} |
||||
|
|
||||
|
|
||||
|
<div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="carousel"> |
||||
|
<div class="carousel-indicators"> |
||||
|
{% for banner in bannery %} |
||||
|
<button |
||||
|
type="button" |
||||
|
data-bs-target="#carouselExampleCaptions" |
||||
|
data-bs-slide-to="{{ forloop.counter0 }}" |
||||
|
{% if forloop.first %}class="active"{% endif %}> |
||||
|
</button> |
||||
|
{% endfor %} |
||||
|
</div> |
||||
|
<div class="carousel-inner"> |
||||
|
{% for banner in bannery %} |
||||
|
<div class="carousel-item {% if forloop.first %}active{% endif %}"> |
||||
|
<img src="/media/{{ banner.obrazek }}" class="d-block w-100" alt="..."> |
||||
|
<div class="carousel-caption d-none d-md-block"> |
||||
|
<h5>{{ banner.popisek }}</h5> |
||||
|
</div> |
||||
|
</div> |
||||
|
{% endfor %} |
||||
|
</div> |
||||
|
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev"> |
||||
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span> |
||||
|
<span class="visually-hidden">Previous</span> |
||||
|
</button> |
||||
|
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next"> |
||||
|
<span class="carousel-control-next-icon" aria-hidden="true"></span> |
||||
|
<span class="visually-hidden">Next</span> |
||||
|
</button> |
||||
|
</div> |
@ -0,0 +1,13 @@ |
|||||
|
from django import template |
||||
|
|
||||
|
from bannery.models import Banner |
||||
|
|
||||
|
|
||||
|
register = template.Library() |
||||
|
|
||||
|
|
||||
|
@register.inclusion_tag('bannery/banner.html') |
||||
|
def banner(): |
||||
|
return { |
||||
|
"bannery": Banner.objects.filter(aktivni=True), |
||||
|
} |
Loading…
Reference in new issue