testing heroku support

pull/20/head
David Ray 2017-02-10 10:46:56 -05:00
commit 9d9f994a01
8 zmienionych plików z 115 dodań i 8 usunięć

Wyświetl plik

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-10 14:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0003_footertext'),
]
operations = [
migrations.AlterModelOptions(
name='footertext',
options={'verbose_name_plural': 'Footer Text'},
),
]

Wyświetl plik

@ -0,0 +1,17 @@
from django import template
from wagtail.wagtailcore.models import Page
from wagtail.wagtailimages.models import Image
register = template.Library()
# Retrieves a single gallery item and returns a gallery of images
@register.inclusion_tag('tags/gallery.html', takes_context=True)
def gallery(context, gallery):
images = Image.objects.filter(collection=gallery)
return {
'images': images,
'request': context['request'],
}

Wyświetl plik

@ -93,7 +93,9 @@ def breadcrumbs(context):
@register.inclusion_tag('base/include/footer.html', takes_context=True)
def get_footer_text(context):
footer_text = FooterText.objects.first().body
footer_text = ""
if FooterText.objects.first() is not None:
footer_text = FooterText.objects.first().body
return {
'footer_text': footer_text,

Wyświetl plik

@ -8,6 +8,8 @@ from wagtail.wagtailcore import blocks
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailsearch import index
from wagtail.wagtailsnippets.models import register_snippet
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
@register_snippet
@ -105,7 +107,24 @@ class BreadsIndexPage(Page):
def get_context(self, request):
context = super(BreadsIndexPage, self).get_context(request)
context['breads'] = BreadPage.objects.descendant_of(
self).live().order_by(
'-first_published_at')
# Get the full unpaginated listing of resource pages as a queryset -
# replace this with your own query as appropriate
all_resources = self.get_children().live()
paginator = Paginator(all_resources, 5) # Show 5 resources per page
page = request.GET.get('page')
try:
resources = paginator.page(page)
except PageNotAnInteger:
# If page is not an integer, deliver first page.
resources = paginator.page(1)
except EmptyPage:
# If page is out of range (e.g. 9999), deliver last page of results.
resources = paginator.page(paginator.num_pages)
# make the variable 'resources' available on the template
context['resources'] = resources
context['paginator'] = paginator
return context

Wyświetl plik

@ -0,0 +1,13 @@
{% extends "base.html" %}
{% load wagtailimages_tags gallery_tags %}
{% block content %}
{{ page.title }}
<div class="image">
{% image page.image width-500 as photo %}
<img src="{{ photo.url }}" width="{{ photo.width }}" height="{{ photo.height }}" alt="{{ photo.alt }}" />
</div>
{% gallery page.choices %}
{% endblock content %}

Wyświetl plik

@ -3,7 +3,38 @@
{% block content %}
{{ page.title }}
{% for bread in breads %}
<div><a href="{{ bread.slug }}">{{ bread.title }}</a></div>
{% endfor %}
{% for bread in resources %}
<div>
<div class="col-xs-12">
<div><a href="{{ bread.slug }}">{{ bread.title }}</a></div>
</div>
</div>
{% endfor %}
{% if resources.has_other_pages %}
<div class="clearfix">
<div class="pagination-wrapper">
<ul class="pagination">
{% if resources.has_previous %}
<li class="arrows"><a href="?q={{ query_string|urlencode }}&amp;page={{ resources.previous_page_number }}" class="arrow-left"></a></li>
{% else %}
<li class="arrows disabled"><span class="arrow-left"></span></li>
{% endif %}
{% for i in resources.paginator.page_range %}
{% if resources.number == i %}
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li><a href="?q={{ query_string|urlencode }}&amp;page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if resources.has_next %}
<li class="arrows"><a href="?q={{ query_string|urlencode }}&amp;page={{ resources.next_page_number }}"><i class="arrow-right"></i></a></li>
{% else %}
<li class="arrows disabled"><span><i class="arrow-right"></i></span></li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% endblock content %}

Wyświetl plik

@ -0,0 +1,7 @@
{% load wagtailimages_tags %}
{% for img in images %}
{% image img max-285x200 as img_obj %}
<div class="col-sm-6"><img src="{{img_obj.url}}" class="img-responsive" /></div>
{{ image.title }}
{% endfor %}

Wyświetl plik

@ -1 +0,0 @@
python manage.py compress --settings bakerydemo.settings.production