Banner on homepage now enabled
This commit is contained in:
parent
9dcd9d496b
commit
612cd5c779
|
@ -6,7 +6,7 @@ from mhackspace.users.models import User
|
|||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Imports the RSS feeds from active blogs'
|
||||
help = 'Build test data for development environment'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
users = AutoFixture(User)
|
||||
|
|
|
@ -5,6 +5,8 @@ from django.db import models
|
|||
from django.utils import timezone
|
||||
from stdimage.models import StdImageField
|
||||
from stdimage.utils import UploadToAutoSlugClassNameDir
|
||||
from stdimage.validators import MinSizeValidator
|
||||
|
||||
|
||||
|
||||
class BannerImages(models.Model):
|
||||
|
@ -20,7 +22,9 @@ class BannerImages(models.Model):
|
|||
'home': {
|
||||
"width": 530,
|
||||
"height": 220,
|
||||
"crop": True}})
|
||||
"crop": True}},
|
||||
validators=[
|
||||
MinSizeValidator(800, 600))
|
||||
|
||||
caption = models.TextField()
|
||||
date = models.DateTimeField(default=timezone.now)
|
||||
|
|
|
@ -6,5 +6,5 @@ register = template.Library()
|
|||
|
||||
@register.inclusion_tag('partials/banner_list.html')
|
||||
def show_banner_images():
|
||||
return {'banner_list': BannerImages.objects.filter(displayed=True)}
|
||||
return {'bannerlist': BannerImages.objects.all(), 'test': 'abc'}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
{% load static from staticfiles %}
|
||||
|
||||
{% block content %}
|
||||
<img src="{% static 'images/logo.svg' %}" class="img-fluid" alt="Responsive image">
|
||||
|
||||
{% show_banner_images %}
|
||||
|
||||
|
@ -13,3 +12,12 @@
|
|||
|
||||
{% show_feeds %}
|
||||
{% endblock content %}
|
||||
|
||||
{% block javascript %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.carousel').carousel();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
{% load static %}
|
||||
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
|
||||
<div class="carousel-inner" role="listbox">
|
||||
{% for banner in bannerlist %}
|
||||
|
||||
<div class="card-columns" id="banners">
|
||||
{% for banner in banners %}
|
||||
<div class="carousel-item">
|
||||
<img src="{{ banner.scaled_image }}" alt="">
|
||||
<div class="carousel-item {% if forloop.first %}active{% endif %}">
|
||||
<img class="img-fluid" src="{{ banner.scaled_image.url }}" alt="">
|
||||
<div class="carousel-caption d-none d-md-block">
|
||||
<h3>{{ banner.title }}</h3>
|
||||
<p>{{ banner.description }}</p>
|
||||
<p>{{ banner.description |truncatewords:30}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue