Compare commits
14 Commits
8b280a33b6
...
f4f6b440b8
Author | SHA1 | Date | |
---|---|---|---|
|
f4f6b440b8 | ||
|
01afa5aa3f | ||
|
daf305d123 | ||
f25482a3e1 | |||
068d9f4201 | |||
f7a5cdf532 | |||
edde0cec38 | |||
774e749d46 | |||
9f87135c5a | |||
|
394580ed51 | ||
|
5b9d746ed7 | ||
|
1b916114de | ||
|
6f2df206c8 | ||
|
c2c80641a8 |
|
@ -25,6 +25,7 @@ body, h1, h2, h3, h4, h5, h6 {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-title {
|
.sidebar-title {
|
||||||
|
@ -114,7 +115,7 @@ ul.clearing-thumbs li {
|
||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
padding-bottom: 20px;
|
line-height: 0.4em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
|
@ -155,3 +156,30 @@ ul.clearing-thumbs li {
|
||||||
table thead, table tbody, table tfoot {
|
table thead, table tbody, table tfoot {
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.search-form[type=search] {
|
||||||
|
width: 15rem;
|
||||||
|
border: 0.125rem solid #e6e6e6;
|
||||||
|
box-shadow: 0 0 3.125rem rgba(0, 0, 0, 0.18);
|
||||||
|
border-radius: 0;
|
||||||
|
background-image: url("http://media.yardhouse.com/images/site/searchicon.png");
|
||||||
|
background-position: 4px center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-color: #111111;
|
||||||
|
padding-left: 30px;
|
||||||
|
position: absolute;
|
||||||
|
color: #ffffff !important;
|
||||||
|
font-size: 10px !important;
|
||||||
|
top: 13px;
|
||||||
|
right: 110px;
|
||||||
|
height: 25px;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,11 @@ urlpatterns = [
|
||||||
url(r'directions.html', RedirectView.as_view(url='/directions/')),
|
url(r'directions.html', RedirectView.as_view(url='/directions/')),
|
||||||
url(r'campstudio.html', RedirectView.as_view(url='/directions/')),
|
url(r'campstudio.html', RedirectView.as_view(url='/directions/')),
|
||||||
|
|
||||||
|
url(r'^texts/index/$', views.section_list, {'section': 'Texts'}, name='texts_list'),
|
||||||
|
url(r'^events/index/$', views.section_list, {'section': 'Events'}, name='events_list'),
|
||||||
|
url(r'^projects/index/$', views.section_list, {'section': 'Projects'}, name='projects_list'),
|
||||||
|
url(r'^works/index/$', views.section_list, {'section': 'Works'}, name='works_list'),
|
||||||
|
|
||||||
url(r'^texts/(?P<shortname>.+)/$', views.texts, name='texts'),
|
url(r'^texts/(?P<shortname>.+)/$', views.texts, name='texts'),
|
||||||
url(r'^events/(?P<shortname>.+)/$', views.events, name='events'),
|
url(r'^events/(?P<shortname>.+)/$', views.events, name='events'),
|
||||||
url(r'^projects/(?P<shortname>.+)/$', views.projects, name='projects'),
|
url(r'^projects/(?P<shortname>.+)/$', views.projects, name='projects'),
|
||||||
|
|
|
@ -35,7 +35,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<form method="get" action='/search/'>
|
||||||
|
<input type="search" name="q" class="search-form" value="{{query|default:""}}">
|
||||||
|
<input type="submit" style="visibility: hidden;" />
|
||||||
|
</form>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -48,21 +51,34 @@
|
||||||
<script src="{% static "js/jquery.bxslider.js" %}"></script>
|
<script src="{% static "js/jquery.bxslider.js" %}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var slider = $('.slider1').bxSlider({
|
slider = $('.slider1').bxSlider({
|
||||||
adaptiveHeight : true,
|
adaptiveHeight : true,
|
||||||
pager : false,
|
pager : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('.select-image').forEach(function(a) {
|
||||||
|
a.onclick = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
slider.goToSlide(parseInt(this.dataset.id) - 1)
|
||||||
|
document.location.hash = '#' + this.dataset.id;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (document.querySelectorAll('.select-image').length && document.location.hash.length) {
|
||||||
|
var slide = parseInt(document.location.hash.slice(1))
|
||||||
|
if (slide) {
|
||||||
|
slider.goToSlide(slide - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).keydown(function(e){
|
$(document).keydown(function(e){
|
||||||
if (e.keyCode == 39) // Right arrow
|
if (e.keyCode == 39) // Right arrow
|
||||||
{
|
{
|
||||||
slider.goToNextSlide();
|
slider && slider.goToNextSlide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (e.keyCode == 37) // left arrow
|
else if (e.keyCode == 37) // left arrow
|
||||||
{
|
{
|
||||||
slider.goToPrevSlide();
|
slider && slider.goToPrevSlide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
19
content/templates/content.html
Normal file
19
content/templates/content.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include "edit.html" %}
|
||||||
|
<div class="large-8 medium-8 columns special-column">
|
||||||
|
{% if content.image %}
|
||||||
|
<img src="{{ content.image_url }}">
|
||||||
|
{% endif %}
|
||||||
|
<div class="index-text">
|
||||||
|
<h4><a href="{{ content.get_absolute_url }}" class="big-title">{{content.title}}</a></h4>
|
||||||
|
<p> {{content.formatted_header|safe}} </p>
|
||||||
|
<p> {{content.formatted_body|safe}} </p>
|
||||||
|
{% include "opt.html" %}
|
||||||
|
{% include "links.html" %}
|
||||||
|
{% include "gallery.html" with gallery=content.gallery %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% include "latest_content.html" %}
|
||||||
|
{% endblock %}
|
|
@ -1,11 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "edit.html" with content=events %}
|
{% include "edit.html" with content=events %}
|
||||||
|
<div class="large-8 medium-8 columns special-column">
|
||||||
<div class="large-8 medium-8 columns special-column">
|
|
||||||
{% if events.image %}
|
{% if events.image %}
|
||||||
<img src="{{events.image_url}}">
|
<img src="{{events.image_url}}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -16,38 +13,7 @@
|
||||||
{% include "opt.html" with content=events %}
|
{% include "opt.html" with content=events %}
|
||||||
{% include "links.html" with content=events %}
|
{% include "links.html" with content=events %}
|
||||||
{% include "gallery.html" with gallery=gallery %}
|
{% include "gallery.html" with gallery=gallery %}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="large-4 medium-4 columns">
|
|
||||||
{% include "related.html" with related=events.children.all %}
|
|
||||||
<h4 class="sidebar-h4">Events </h4>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
{% for events in latest_content_list %}
|
|
||||||
|
|
||||||
<div class="row right-items">
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ events.get_absolute_url }}/"> <img src="{{ events.image_url }}"> </a>
|
|
||||||
</div>
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ events.get_absolute_url }}/" class="sidebar-title" >{{ events.title }}</a>
|
|
||||||
<h6 class="sidebar-date">
|
|
||||||
<font color="#ef4e5c">
|
|
||||||
<b> {{ events.datestart }} {% if events.dateend %} - {{events.dateend}} {% endif %} </b>
|
|
||||||
</font>
|
|
||||||
{% if events.place %}<br/>{{events.place}}{% endif%}
|
|
||||||
</h6>
|
|
||||||
<p> {{ events.formatted_teaser }} </p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% include "latest_content.html" with content=events %}
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% for content in featured %}
|
{% for content in featured %}
|
||||||
<div class="large-8 medium-8 columns special-column">
|
<div class="large-8 medium-8 columns special-column">
|
||||||
{% if content.image %}
|
{% if content.image %}
|
||||||
<img src="{{ content.image_url }}">
|
<a href="{{ content.get_absolute_url }}"><img src="{{ content.image_url }}"> </a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="index-text">
|
<div class="index-text">
|
||||||
<h4><a href="{{ content.get_absolute_url }}" class="big-title">{{content.title}} </a></h4>
|
<h4><a href="{{ content.get_absolute_url }}" class="big-title">{{content.title}} </a></h4>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<h6><strong>Gallery: {{gallery.title}}</strong></h6>
|
<h6><strong>Gallery: {{gallery.title}}</strong></h6>
|
||||||
<ul class="clearing-thumbs" data-clearing>
|
<ul class="clearing-thumbs" data-clearing>
|
||||||
{% for photo in gallery.public %}
|
{% for photo in gallery.public %}
|
||||||
<li><a href="{{ photo.get_absolute_url }}"><img src="{{ photo.get_thumbnail_url }}"></a></li>
|
<li><a href="{{ gallery.get_absolute_url }}#{{forloop.counter}}"><img src="{{ photo.get_thumbnail_url }}"></a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
18
content/templates/latest_content.html
Normal file
18
content/templates/latest_content.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<div class="large-4 medium-4 columns">
|
||||||
|
{% include "related.html" with related=content.children.all %}
|
||||||
|
{% if latest_content_list %}
|
||||||
|
<h4 class="sidebar-h4">{{section}}</h4>
|
||||||
|
<div class="row">
|
||||||
|
{% for content in latest_content_list %}
|
||||||
|
{% include "preview.html" with content=content %}
|
||||||
|
{% endfor %}
|
||||||
|
{% with section|lower|add:'_list' as section_list %}
|
||||||
|
{% if has_more_content %}
|
||||||
|
<a href="{% url section_list %}">more</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{% if 0 %}<p>No content.</p>{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
|
@ -1,12 +1,16 @@
|
||||||
{% if content.optbtn2 and content.opttext2 %}
|
{% if content.opttext2 %}
|
||||||
<div class="part2">
|
<div class="part2">
|
||||||
|
{% if content.optbtn2 %}
|
||||||
<h4>{{ content.optbtn2|safe }} </h4>
|
<h4>{{ content.optbtn2|safe }} </h4>
|
||||||
|
{% endif %}
|
||||||
<p>{{ content.opttext2|safe|linebreaks }}</p>
|
<p>{{ content.opttext2|safe|linebreaks }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if content.optbtn3 and content.opttext3 %}
|
{% if content.opttext3 %}
|
||||||
<div class="part3">
|
<div class="part3">
|
||||||
|
{% if content.optbtn3 %}
|
||||||
<h4>{{ content.optbtn3|safe }} </h4>
|
<h4>{{ content.optbtn3|safe }} </h4>
|
||||||
|
{% endif %}
|
||||||
<p>{{ content.opttext3|safe|linebreaks }}</p>
|
<p>{{ content.opttext3|safe|linebreaks }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% include "edit.html" with content=content %}
|
||||||
<div class="large-8 medium-8 columns special-column">
|
<div class="large-8 medium-8 columns special-column">
|
||||||
<div class="index-text">
|
<div class="index-text">
|
||||||
<h4>{{content.title}}</h4>
|
<h4>{{content.title}}</h4>
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
<p>
|
<p>
|
||||||
{{content.formatted_body|safe}}
|
{{content.formatted_body|safe}}
|
||||||
</p>
|
</p>
|
||||||
|
{% include "opt.html" with content=content %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,16 +4,39 @@
|
||||||
{% block title %}{{ gallery.title }}{% endblock %}
|
{% block title %}{{ gallery.title }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row col-lg-12">
|
<div class="row">
|
||||||
<h1 class="page-header">{{ gallery.title }}</h1>
|
<div class="medium-9 columns">
|
||||||
<p class="muted"><small>{% trans "Published" %} {{ gallery.date_added }}</small></p>
|
{% if gallery.content.exists %}
|
||||||
{% if gallery.description %}{{ gallery.description|safe }}{% endif %}
|
<h6 class="page-header"><a href="{{ gallery.content.all.0.get_absolute_url }}">Back to {{ gallery.content.all.0.title }}</a></h6>
|
||||||
|
{% endif %}
|
||||||
|
<h5>{{ gallery.title }}</h5>
|
||||||
|
<ul class="slider1">
|
||||||
{% for photo in gallery.public %}
|
{% for photo in gallery.public %}
|
||||||
<a href="{{ photo.get_absolute_url }}">
|
<li id="slide-{{photo.slug}}">
|
||||||
|
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
|
||||||
|
<p>
|
||||||
|
{{ photo.caption|safe }}
|
||||||
|
{% if photo.caption %}<br>{%endif%}
|
||||||
|
<a href="{{ photo.image.url }}" target="_blank" >Link to original file</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="medium-3 columns">
|
||||||
|
<br>
|
||||||
|
<p>{% trans "Other photos" %}:</p>
|
||||||
|
<div>
|
||||||
|
{% for photo in gallery.public %}
|
||||||
|
<div style="float: left; padding: 4px">
|
||||||
|
<a href="{{ photo.get_absolute_url }}" class="select-image" data-id="{{forloop.counter}}">
|
||||||
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}">
|
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}">
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
|
||||||
<div><a href="{% url 'photologue:gallery-list' %}" class="btn btn-default">{% trans "View all galleries" %}</a></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,42 +4,21 @@
|
||||||
{% block title %}{{ object.title }}{% endblock %}
|
{% block title %}{{ object.title }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% for gallery in object.public_galleries %}
|
<div class="row">
|
||||||
<div class="row">
|
|
||||||
<div class="medium-9 columns">
|
<div class="medium-9 columns">
|
||||||
<h5 class="page-header">From gallery {{ gallery.title }}</h5>
|
<img src="{{ object.get_display_url }}" alt="{{ object.title }}">
|
||||||
<ul class="slider1">
|
<p>
|
||||||
{% for photo.pk in gallery.public %}
|
{{ object.caption|safe }}
|
||||||
<li>
|
{% if object.caption %}<br>{%endif%}
|
||||||
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
|
<a href="{{ object.image.url }}" target="_blank" >Link to original file</a>
|
||||||
<br /> <p>{{ photo.caption|safe }} <a href="{{ photo.image.url }}"> Link to original file </a> </p>
|
</p>
|
||||||
</li>
|
<ul>
|
||||||
{% for photo in gallery.public %}
|
{% for gallery in object.public_galleries %}
|
||||||
<li>
|
{% if gallery.content.exists %}
|
||||||
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
|
<li><a href="{{ gallery.content.all.0.get_absolute_url }}">{{ gallery.content.all.0.title }}</a></li>
|
||||||
<br /> <p>{{ photo.caption|safe }} <a href="{{ photo.image.url }}" target="_blank" > Link to original file </a> </p>
|
{% endif %}
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="medium-3 columns">
|
</div>
|
||||||
{% if object.public_galleries %}
|
|
||||||
<p>{% trans "Other photos in the gallery" %}:</p>
|
|
||||||
<table>
|
|
||||||
{% for photo in gallery.public %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ photo.get_absolute_url }}">
|
|
||||||
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}"></a></td>
|
|
||||||
<td>
|
|
||||||
<p>{{ photo.caption|safe }} {{ photo.count }} </p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,8 +1,17 @@
|
||||||
<div class="row">
|
<div class="row right-items">
|
||||||
<div class="row right-items">
|
{% if content.type.name == 'news' %}
|
||||||
|
<div class= "small-12 columns">
|
||||||
|
<h6 class="sidebar-date">
|
||||||
|
<font color="#ef4e5c"> <b> {{content.datestart}} </b>
|
||||||
|
{{ content.title }} <br />
|
||||||
|
{{ content.formatted_header }}
|
||||||
|
</font>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
{% if content.image_url %}
|
{% if content.image_url %}
|
||||||
<img src="{{ content.image_url }}">
|
<a href="{{ content.get_absolute_url }}"><img src="{{ content.image_url }}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
|
@ -17,5 +26,5 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p> {{ content.formatted_teaser }} </p>
|
<p> {{ content.formatted_teaser }} </p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
</div>
|
</div>
|
|
@ -1,11 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "edit.html" with content=projects %}
|
{% include "edit.html" with content=projects %}
|
||||||
|
<div class="large-8 medium-8 columns special-column">
|
||||||
<div class="large-8 medium-8 columns special-column">
|
|
||||||
{% if projects.image %}
|
{% if projects.image %}
|
||||||
<img src="{{ projects.image_url }}">
|
<img src="{{ projects.image_url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -16,31 +13,7 @@
|
||||||
{% include "opt.html" with content=projects %}
|
{% include "opt.html" with content=projects %}
|
||||||
{% include "links.html" with content=projects %}
|
{% include "links.html" with content=projects %}
|
||||||
{% include "gallery.html" with gallery=gallery %}
|
{% include "gallery.html" with gallery=gallery %}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if latest_content_list %}
|
|
||||||
|
|
||||||
<div class="large-4 medium-4 columns">
|
|
||||||
{% include "related.html" with related=projects.children.all %}
|
|
||||||
<h4 class="sidebar-h4">Projects </h4>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
{% for projects in latest_content_list %}
|
|
||||||
<div class="row right-items">
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ projects.get_absolute_url }}"> <img src="{{ projects.image_url }}"> </a>
|
|
||||||
</div>
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ projects.get_absolute_url }}" class="sidebar-title">{{ projects.title }}</a>
|
|
||||||
<p> {{projects.formatted_teaser}} </p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% include "latest_content.html" with content=texts %}
|
||||||
{% else %}
|
|
||||||
<p>No projects.</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{% if related %}
|
{% if related %}
|
||||||
<h4 class="sidebar-h4"> Related </h4>
|
<h4 class="sidebar-h4"> Related </h4>
|
||||||
{% for content in related %}
|
{% for content in related %}
|
||||||
{% include "preview.html" %}
|
<div class="row">
|
||||||
|
{% include "preview.html" %}
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -5,61 +5,62 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-4 small-offset-2 columns results-title">
|
<div class="small-4 small-offset-2 columns results-title">
|
||||||
|
{% if section %}
|
||||||
|
<h3> {{section }}</h3>
|
||||||
|
{% else %}
|
||||||
<h3> Search results </h3>
|
<h3> Search results </h3>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% for content in results %}
|
{% for row in content %}
|
||||||
{% if content.type.name == 'news' %}
|
{% if row.type.name == 'news' %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class= "small-4 small-offset-2 columns">
|
<div class= "small-4 small-offset-2 columns">
|
||||||
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{content.datestart}} </b>
|
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{row.datestart}} </b>
|
||||||
{{ content.title }} <br />
|
{{ row.title }} <br />
|
||||||
{{ content.formatted_header|striptags|safe }} </font>
|
{{ row.formatted_header|striptags|safe }} </font>
|
||||||
</h6>
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% elif content.type.name == 'events' %}
|
{% else %}
|
||||||
<div class="row results">
|
<div class="row results">
|
||||||
<div class="small-4 small-offset-2 columns">
|
<div class="small-4 small-offset-2 columns">
|
||||||
<img src="{{ content.image_url }}">
|
{% if row.image_url %}
|
||||||
|
<a href="{{ row.get_absolute_url }}"> <img src="{{ row.image_url }}"> </a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="small-4 end columns">
|
<div class="small-4 end columns">
|
||||||
<a href="{{ content.get_absolute_url }}" class="sidebar-title">{{ content.title }}</a>
|
<a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a>
|
||||||
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{ content.datestart }} {% if content.dateend %} - {{content.dateend}} {% endif %} </b></font>
|
{% if row.type.name == 'events' %}
|
||||||
{% if content.place %}<br/> {{content.place}} {% endif%}</h6>
|
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{ row.datestart }} {% if row.dateend %} - {{row.dateend}} {% endif %} </b></font>
|
||||||
<p> {{content.header|striptags|safe}} </p>
|
{% if row.place %}<br/> {{row.place}} {% endif%}</h6>
|
||||||
<a href="{{ content.get_absolute_url }}">read more</a> </p>
|
{% endif %}
|
||||||
|
<p> {{row.formatted_teaser}} </p>
|
||||||
|
<a href="{{ row.get_absolute_url }}">read more</a> </p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-4 small-offset-2 columns">
|
|
||||||
Add view for content type: {{content.type}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
{% if results.has_other_pages %}
|
{% if content.has_other_pages %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-4 small-offset-4 columns">
|
<div class="small-4 small-offset-4 columns">
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
{% if results.has_previous %}
|
{% if content.has_previous %}
|
||||||
<li><a href="?q={{ query }}&page={{ results.previous_page_number }}">«</a></li>
|
<li><a href="?{{ base_query }}&page={{ content.previous_page_number }}">«</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="disabled"><span>«</span></li>
|
<li class="disabled"><span>«</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for i in results.paginator.page_range %}
|
{% for i in content.paginator.page_range %}
|
||||||
{% if results.number == i %}
|
{% if content.number == i %}
|
||||||
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
|
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="?q={{ query }}&page={{ i }}">{{ i }}</a></li>
|
<li><a href="?{{ base_query }}page={{ i }}">{{ i }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if results.has_next %}
|
{% if content.has_next %}
|
||||||
<li><a href="?q={{ query }}&page={{ results.next_page_number }}">»</a></li>
|
<li><a href="?{{ base_query }}page={{ content.next_page_number }}">»</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="disabled"><span>»</span></li>
|
<li class="disabled"><span>»</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{% include "featured.html" %}
|
{% include "featured.html" %}
|
||||||
|
|
||||||
<div class="large-4 medium-4 columns">
|
<div class="large-4 medium-4 columns">
|
||||||
|
{% if content %}
|
||||||
<h4 class="sidebar-h4"> {{ section }} </h4>
|
<h4 class="sidebar-h4"> {{ section }} </h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for content in content %}
|
{% for content in content %}
|
||||||
|
@ -19,7 +20,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if more_content %}
|
||||||
|
<a href="index/">more</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% include "edit.html" with content=texts %}
|
||||||
<div class="large-8 medium-8 columns special-column">
|
<div class="large-8 medium-8 columns special-column">
|
||||||
{% if texts.image %}
|
{% if texts.image %}
|
||||||
<img src="{{ texts.image_url }}">
|
<img src="{{ texts.image_url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -11,47 +11,7 @@
|
||||||
<p> {{texts.formatted_header|safe}} </p>
|
<p> {{texts.formatted_header|safe}} </p>
|
||||||
<p> {{texts.formatted_body|safe}} </p>
|
<p> {{texts.formatted_body|safe}} </p>
|
||||||
{% include "opt.html" with content=texts %}
|
{% include "opt.html" with content=texts %}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if latest_content_list %}
|
|
||||||
|
|
||||||
<div class="large-4 medium-4 columns">
|
|
||||||
{% if texts.children.all %}
|
|
||||||
<h4 class="sidebar-h4"> Related </h4>
|
|
||||||
{% for child in texts.children.all %}
|
|
||||||
<div class="row related-row">
|
|
||||||
{% if child.image %}
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ child.get_absolute_url }}"> <img src="{{ child.image_url }}"> </a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<h6><a href="{{ child.get_absolute_url }}" class="sidebar-title"> {{child}} </a> </h6>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% include "latest_content.html" with content=texts %}
|
||||||
{% endif %}
|
|
||||||
<h4 class="sidebar-h4"> Texts </h4>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
{% for texts in latest_content_list %}
|
|
||||||
<div class="row right-items">
|
|
||||||
{% if texts.image %}
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ texts.get_absolute_url }}"> <img src="{{ texts.image_url }}"></a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ texts.get_absolute_url }}" class="sidebar-title">{{ texts.title }}</a>
|
|
||||||
<p> {{texts.header|striptags|truncatechars:100}} </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
<p>No texts.</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,52 +1,19 @@
|
||||||
|
|
||||||
|
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% include "edit.html" with content=works %}
|
||||||
<div class="large-8 medium-8 columns special-column">
|
<div class="large-8 medium-8 columns special-column">
|
||||||
|
{% if works.image %}
|
||||||
<img src="{{ works.image_url }}">
|
<img src="{{ works.image_url }}">
|
||||||
|
{% endif %}
|
||||||
<div class="index-text">
|
<div class="index-text">
|
||||||
<h4><a href="{{ works.get_absolute_url }}" class="big-title">{{works.title}} </a></h4>
|
<h4><a href="{{ works.get_absolute_url }}" class="big-title">{{works.title}} </a></h4>
|
||||||
<p> {{works.formatted_header|safe}} </p>
|
<p> {{works.formatted_header|safe}} </p>
|
||||||
<p> {{works.formatted_body|safe}} </p>
|
<p> {{works.formatted_body|safe}} </p>
|
||||||
</div>
|
{% include "opt.html" with content=works %}
|
||||||
</div>
|
{% include "links.html" with content=projects %}
|
||||||
|
{% include "gallery.html" with gallery=gallery %}
|
||||||
{% if latest_content_list %}
|
|
||||||
|
|
||||||
<div class="large-4 medium-4 columns">
|
|
||||||
{% if works.children.all %}
|
|
||||||
<h4 class="sidebar-h4"> Related </h4>
|
|
||||||
{% for child in works.children.all %}
|
|
||||||
<div class="row related-row">
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ child.get_absolute_url }}"> <img src="{{ child.image_url }}"> </a>
|
|
||||||
</div>
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<h6><a href="{{ child.get_absolute_url }}" class="sidebar-title"> {{child}} </a> </h6>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% include "latest_content.html" with content=works %}
|
||||||
{% endif %}
|
|
||||||
<h4 class="sidebar-h4"> Works </h4>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
{% for works in latest_content_list %}
|
|
||||||
<div class="row right-items">
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ works.get_absolute_url }}"> <img src="{{ works.image_url }}"></a>
|
|
||||||
</div>
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="{{ works.get_absolute_url }}" class="sidebar-title">{{ works.title }}</a>
|
|
||||||
<p> {{works.header|striptags|truncatechars:100}} </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
<p>No works.</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
156
content/views.py
156
content/views.py
|
@ -1,5 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
@ -24,7 +25,7 @@ def index(request):
|
||||||
base = base.filter(published=True)
|
base = base.filter(published=True)
|
||||||
upcoming_events = base.filter(datestart__gt=now)[:12]
|
upcoming_events = base.filter(datestart__gt=now)[:12]
|
||||||
ongoing_events = base.filter(datestart__lt=now, dateend__gte=now)[:12]
|
ongoing_events = base.filter(datestart__lt=now, dateend__gte=now)[:12]
|
||||||
past_events = base.filter(Q(dateend__lt=now)|Q(dateend=None, datestart__lt=now))[:12]
|
past_events = base.filter(Q(dateend__lt=now) | Q(dateend=None, datestart__lt=now))[:12]
|
||||||
|
|
||||||
homepage = Content.objects.filter(type__name='homepage').order_by('-datestart')[:1]
|
homepage = Content.objects.filter(type__name='homepage').order_by('-datestart')[:1]
|
||||||
context = {
|
context = {
|
||||||
|
@ -35,21 +36,65 @@ def index(request):
|
||||||
return render(request, 'index.html', context)
|
return render(request, 'index.html', context)
|
||||||
|
|
||||||
|
|
||||||
def section_index(request, types, section):
|
SECTION_TYPE = {
|
||||||
featured = Content.objects.filter(type__name__in=types, featured=True).order_by('-datestart')[:1]
|
'Projects': ['projects'],
|
||||||
|
'Works': ['works'],
|
||||||
|
'Texts': ['texts'],
|
||||||
|
'Events': ['events', 'news'],
|
||||||
|
}
|
||||||
|
|
||||||
|
def section_content(section):
|
||||||
|
types = SECTION_TYPE.get(section, [section.lower()])
|
||||||
content = Content.objects.filter(type__name__in=types).order_by('-datestart')
|
content = Content.objects.filter(type__name__in=types).order_by('-datestart')
|
||||||
|
content = content.filter(published=True)
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
|
def section_index(request, section, max_length=10):
|
||||||
|
types = SECTION_TYPE.get(section, [section.lower()])
|
||||||
|
featured = Content.objects.filter(type__name__in=types, featured=True).order_by('-datestart')[:1]
|
||||||
|
content = section_content(section)
|
||||||
if featured:
|
if featured:
|
||||||
content = content.exclude(pk=featured[0].pk)
|
content = content.exclude(pk=featured[0].pk)
|
||||||
content = content.filter(published=True)
|
more_content = content.count() > max_length
|
||||||
|
content = content[:max_length]
|
||||||
return render(request, 'section_index.html', {
|
return render(request, 'section_index.html', {
|
||||||
'section': section,
|
'section': section,
|
||||||
'featured': featured,
|
'featured': featured,
|
||||||
'content': content
|
'content': content,
|
||||||
|
'more_content': more_content,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def section_list(request, section):
|
||||||
|
content = section_content(section)
|
||||||
|
|
||||||
|
q = request.GET.get('q')
|
||||||
|
content = limit_content(content, q)
|
||||||
|
|
||||||
|
page = request.GET.get('page', 1)
|
||||||
|
paginator = Paginator(content, 5)
|
||||||
|
try:
|
||||||
|
content = paginator.page(page)
|
||||||
|
except PageNotAnInteger:
|
||||||
|
content = paginator.page(1)
|
||||||
|
except EmptyPage:
|
||||||
|
content = paginator.page(paginator.num_pages)
|
||||||
|
|
||||||
|
base_query = ''
|
||||||
|
if q:
|
||||||
|
base_query = 'q=%s&' % q
|
||||||
|
|
||||||
|
return render(request, 'results.html', {
|
||||||
|
'base_query': base_query,
|
||||||
|
'content': content,
|
||||||
|
'query': q,
|
||||||
|
'section': section,
|
||||||
})
|
})
|
||||||
|
|
||||||
def event(request):
|
def event(request):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
display_events = ['events']
|
display_events = ['events', 'news']
|
||||||
featured = Content.objects.filter(type__name='events', featured=True).order_by('-datestart')[:1]
|
featured = Content.objects.filter(type__name='events', featured=True).order_by('-datestart')[:1]
|
||||||
base = Content.objects.filter(type__name__in=display_events).order_by('-datestart')
|
base = Content.objects.filter(type__name__in=display_events).order_by('-datestart')
|
||||||
base = base.filter(published=True)
|
base = base.filter(published=True)
|
||||||
|
@ -58,62 +103,60 @@ def event(request):
|
||||||
|
|
||||||
upcoming_events = base.filter(datestart__gt=now).order_by('-datestart')
|
upcoming_events = base.filter(datestart__gt=now).order_by('-datestart')
|
||||||
ongoing_events = base.filter(datestart__lt=now, dateend__gte=now).order_by('-datestart')
|
ongoing_events = base.filter(datestart__lt=now, dateend__gte=now).order_by('-datestart')
|
||||||
past_events = base.filter(Q(dateend__lt=now)|Q(dateend=None, datestart__lt=now))[:10]
|
past_events = base.filter(Q(dateend__lt=now) | Q(dateend=None, datestart__lt=now))[:10]
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'upcoming_events': upcoming_events,
|
'upcoming_events': upcoming_events,
|
||||||
'ongoing_events': ongoing_events,
|
'ongoing_events': ongoing_events,
|
||||||
'past_events': past_events,
|
'past_events': past_events,
|
||||||
'featured': featured,
|
'featured': featured,
|
||||||
|
'section': 'Events',
|
||||||
}
|
}
|
||||||
return render(request, 'event.html', context)
|
return render(request, 'event.html', context)
|
||||||
|
|
||||||
|
|
||||||
def events(request, shortname=None):
|
def get_related_content(types, current=None, max_length=10):
|
||||||
|
latest_content_list = Content.objects.filter(type__name__in=types).order_by('-datestart')
|
||||||
|
if current:
|
||||||
|
latest_content_list = latest_content_list.exclude(pk=current.pk)
|
||||||
|
latest_content_list = latest_content_list.filter(published=True)
|
||||||
|
more = latest_content_list.count() > max_length
|
||||||
|
latest_content_list = latest_content_list[:max_length]
|
||||||
|
return latest_content_list, more
|
||||||
|
|
||||||
|
|
||||||
|
def render_content(request, shortname, section, template, types):
|
||||||
if not shortname:
|
if not shortname:
|
||||||
|
if section == 'Events':
|
||||||
return event(request)
|
return event(request)
|
||||||
events = get_object_or_404(Content, shortname=shortname, type__name__in=['news', 'events'])
|
else:
|
||||||
if not events.published and not request.user.is_staff:
|
return section_index(request, section)
|
||||||
|
content = get_object_or_404(Content, shortname=shortname, type__name__in=types)
|
||||||
|
if not content.published and not request.user.is_staff:
|
||||||
raise Http404
|
raise Http404
|
||||||
gallery = get_or_none(Gallery, slug=shortname)
|
latest_content_list, more = get_related_content(types, content)
|
||||||
latest_content_list = Content.objects.filter(type__name='events').order_by('-datestart')[:10]
|
return render(request, template, {
|
||||||
return render(request, 'events.html', {'events': events, 'latest_content_list': latest_content_list, 'gallery': gallery})
|
'content': content,
|
||||||
|
'latest_content_list': latest_content_list,
|
||||||
|
'has_more_content': more,
|
||||||
|
'section': section,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def events(request, shortname=None):
|
||||||
|
return render_content(request, shortname, 'Events', 'content.html', ['events', 'news'])
|
||||||
|
|
||||||
|
|
||||||
def projects(request, shortname=None):
|
def projects(request, shortname=None):
|
||||||
if not shortname:
|
return render_content(request, shortname, 'Projects', 'content.html', ['projects'])
|
||||||
return section_index(request, ['projects'], 'Projects')
|
|
||||||
projects = get_object_or_404(Content, shortname=shortname, type__name='projects')
|
|
||||||
if not projects.published and not request.user.is_staff:
|
|
||||||
raise Http404
|
|
||||||
gallery = get_or_none(Gallery, slug=shortname)
|
|
||||||
latest_content_list = Content.objects.filter(type__name='projects').order_by('-datestart')
|
|
||||||
return render(request, 'projects.html', {
|
|
||||||
'projects': projects,
|
|
||||||
'latest_content_list': latest_content_list,
|
|
||||||
'gallery': gallery
|
|
||||||
})
|
|
||||||
|
|
||||||
def works(request, shortname=None):
|
def works(request, shortname=None):
|
||||||
if not shortname:
|
return render_content(request, shortname, 'Works', 'content.html', ['works'])
|
||||||
return section_index(request, ['works'], 'Works')
|
|
||||||
works = get_object_or_404(Content, shortname=shortname, type__name='works')
|
|
||||||
if not works.published and not request.user.is_staff:
|
|
||||||
raise Http404
|
|
||||||
gallery = get_or_none(Gallery, slug=shortname)
|
|
||||||
latest_content_list = Content.objects.filter(type__name='works')
|
|
||||||
return render(request, 'works.html', {'works': works, 'latest_content_list': latest_content_list, 'gallery':gallery})
|
|
||||||
|
|
||||||
def texts(request, shortname=None):
|
def texts(request, shortname=None):
|
||||||
if not shortname:
|
return render_content(request, shortname, 'Texts', 'content.html', ['texts'])
|
||||||
return section_index(request, ['texts'], 'Texts')
|
|
||||||
texts = get_object_or_404(Content, shortname=shortname, type__name='texts')
|
|
||||||
gallery = get_or_none(Gallery, slug=shortname)
|
|
||||||
latest_content_list = Content.objects.filter(type__name='texts')
|
|
||||||
return render(request, 'texts.html', {
|
|
||||||
'texts': texts,
|
|
||||||
'latest_content_list': latest_content_list,
|
|
||||||
'gallery': gallery
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def page(request, shortname):
|
def page(request, shortname):
|
||||||
|
@ -123,22 +166,33 @@ def page(request, shortname):
|
||||||
return render(request, 'page.html', {'content': content})
|
return render(request, 'page.html', {'content': content})
|
||||||
|
|
||||||
|
|
||||||
|
def limit_content(content, q):
|
||||||
|
if q:
|
||||||
|
content = content.filter(Q(body__icontains=q) | Q(title__icontains=q) | Q(header__icontains=q)).distinct()
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
def search(request):
|
def search(request):
|
||||||
|
content = Content.objects.filter(published=True).order_by('-datestart')
|
||||||
|
content = content.exclude(type__name__in=['page', 'homepage'])
|
||||||
q = request.GET.get('q')
|
q = request.GET.get('q')
|
||||||
results = Content.objects.filter(Q(body__icontains=q) | Q(title__icontains=q) | Q(header__icontains=q)).distinct()
|
content = limit_content(content, q)
|
||||||
results = results.filter(published=True)
|
|
||||||
results = results.order_by('-datestart')
|
|
||||||
page = request.GET.get('page', 1)
|
page = request.GET.get('page', 1)
|
||||||
paginator = Paginator(results, 5)
|
paginator = Paginator(content, 5)
|
||||||
try:
|
try:
|
||||||
results = paginator.page(page)
|
content = paginator.page(page)
|
||||||
except PageNotAnInteger:
|
except PageNotAnInteger:
|
||||||
results = paginator.page(1)
|
content = paginator.page(1)
|
||||||
except EmptyPage:
|
except EmptyPage:
|
||||||
results = paginator.page(paginator.num_pages)
|
content = paginator.page(paginator.num_pages)
|
||||||
|
|
||||||
|
base_query = ''
|
||||||
|
if q:
|
||||||
|
base_query = 'q=%s&' % q
|
||||||
|
|
||||||
return render(request, 'results.html', {
|
return render(request, 'results.html', {
|
||||||
'results': results,
|
'base_query': base_query,
|
||||||
|
'content': content,
|
||||||
'query': q
|
'query': q
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user