Compare commits
No commits in common. "ff4e0b23254b6b80b6354e29c96147693d0c60b0" and "25db5b28683eb22f9ee9225d4eef5b4c21f82fbc" have entirely different histories.
ff4e0b2325
...
25db5b2868
|
@ -55,7 +55,7 @@ MIDDLEWARE = [
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
#'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'camp.urls'
|
ROOT_URLCONF = 'camp.urls'
|
||||||
|
@ -63,9 +63,7 @@ ROOT_URLCONF = 'camp.urls'
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [
|
'DIRS': [],
|
||||||
os.path.join(BASE_DIR, 'camp', 'templates')
|
|
||||||
],
|
|
||||||
'APP_DIRS': False,
|
'APP_DIRS': False,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
.slider1 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
|
@ -66,7 +66,7 @@ a:focus, a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.index-text p {
|
.index-text p {
|
||||||
//text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-bar-right {
|
.title-bar-right {
|
||||||
|
|
|
@ -1386,8 +1386,7 @@
|
||||||
} else {
|
} else {
|
||||||
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
||||||
if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
|
if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
|
||||||
// fails with slow connections
|
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
||||||
//slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
|
||||||
}
|
}
|
||||||
// if carousel and not infinite loop
|
// if carousel and not infinite loop
|
||||||
if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
|
if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
|
||||||
|
@ -1433,9 +1432,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
|
if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
|
||||||
if (!slider.working) {
|
|
||||||
el.redrawSlider()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -143,25 +143,10 @@ class Content(models.Model):
|
||||||
def typefilter(self):
|
def typefilter(self):
|
||||||
return self.type
|
return self.type
|
||||||
|
|
||||||
def admin_thumbnail_(self):
|
|
||||||
src = None
|
|
||||||
if self.photo:
|
|
||||||
src = self.photo.get_thumbnail_url()
|
|
||||||
if self.image:
|
|
||||||
if self.image.startswith('http') or self.image.startswith('/'):
|
|
||||||
src = self.image
|
|
||||||
else:
|
|
||||||
src = settings.IMAGE_PREFIX + self.image
|
|
||||||
if src:
|
|
||||||
return mark_safe(u'<a href="{}"><img src="{}"></a>'.format(self.get_absolute_url(), src))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def image_url(self):
|
def image_url(self):
|
||||||
if self.photo:
|
if self.photo:
|
||||||
url = self.photo.image.url
|
return self.photo.get_display_url()
|
||||||
if not url.lower().endswith('.gif'):
|
|
||||||
url = self.photo.get_display_url()
|
|
||||||
return url
|
|
||||||
if self.image:
|
if self.image:
|
||||||
if self.image.startswith('http') or self.image.startswith('/'):
|
if self.image.startswith('http') or self.image.startswith('/'):
|
||||||
return self.image
|
return self.image
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{% load available_content static %}
|
{% load available_content%}
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html class="no-js" lang="en">
|
<html class="no-js" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
{% block head %}
|
|
||||||
<title>Studio CAMP</title>
|
<title>Studio CAMP</title>
|
||||||
{% endblock %}
|
|
||||||
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans"/>
|
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans"/>
|
||||||
|
{% load static %}
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "css/foundation.css" %}">
|
<link rel="stylesheet" type="text/css" href="{% static "css/foundation.css" %}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "css/jquery.bxslider.css" %}">
|
<link rel="stylesheet" type="text/css" href="{% static "css/jquery.bxslider.css" %}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "css/main.css" %}">
|
<link rel="stylesheet" type="text/css" href="{% static "css/main.css" %}">
|
||||||
|
@ -50,36 +49,14 @@
|
||||||
<script src="{% static "js/foundation.js" %}"></script>
|
<script src="{% static "js/foundation.js" %}"></script>
|
||||||
<script src="{% static "js/app.js" %}"></script>
|
<script src="{% static "js/app.js" %}"></script>
|
||||||
<script src="{% static "js/what-input.js" %}"></script>
|
<script src="{% static "js/what-input.js" %}"></script>
|
||||||
<script src="{% static "js/jquery.bxslider.js" %}?2"></script>
|
<script src="{% static "js/jquery.bxslider.js" %}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var startSlide = 0;
|
$(document).ready(function(){
|
||||||
if (document.querySelectorAll('.select-image').length && document.location.hash.length) {
|
slider = $('.slider1').bxSlider({
|
||||||
startSlide = parseInt(document.location.hash.slice(1)) - 1
|
|
||||||
}
|
|
||||||
function loadSlideshow() {
|
|
||||||
$('a.original-link').bind('touchstart MSPointerDown pointerdown', function(event) {
|
|
||||||
event.stopPropagation()
|
|
||||||
});
|
|
||||||
$('a.original-link').on({
|
|
||||||
mousedown: function(event) {
|
|
||||||
event.stopPropagation()
|
|
||||||
},
|
|
||||||
})
|
|
||||||
slider = $('.slider1').show().bxSlider({
|
|
||||||
startSlide: startSlide,
|
|
||||||
preloadImages: 'all',
|
|
||||||
adaptiveHeight : true,
|
adaptiveHeight : true,
|
||||||
pager : false,
|
pager : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
var images = $('.slider1 img'), count = images.length;
|
|
||||||
images.on({load: function(event) {
|
|
||||||
setTimeout(function() {
|
|
||||||
slider.resize()
|
|
||||||
slider.redrawSlider()
|
|
||||||
}, 100)
|
|
||||||
}})
|
|
||||||
|
|
||||||
document.querySelectorAll('.select-image').forEach(function(a) {
|
document.querySelectorAll('.select-image').forEach(function(a) {
|
||||||
a.onclick = function(event) {
|
a.onclick = function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -87,21 +64,12 @@
|
||||||
document.location.hash = '#' + this.dataset.id;
|
document.location.hash = '#' + this.dataset.id;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
if (document.querySelectorAll('.select-image').length && document.location.hash.length) {
|
if (document.querySelectorAll('.select-image').length && document.location.hash.length) {
|
||||||
var slide = parseInt(document.location.hash.slice(1))
|
var slide = parseInt(document.location.hash.slice(1))
|
||||||
if (slide) {
|
if (slide) {
|
||||||
slider.goToSlide(slide - 1)
|
slider.goToSlide(slide - 1)
|
||||||
slider.resize()
|
|
||||||
slider.redrawSlider()
|
|
||||||
setTimeout(function() {
|
|
||||||
slider.resize()
|
|
||||||
slider.redrawSlider()
|
|
||||||
}, 2000)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
$(document).keydown(function(e){
|
$(document).keydown(function(e){
|
||||||
if (e.keyCode == 39) // Right arrow
|
if (e.keyCode == 39) // Right arrow
|
||||||
|
@ -115,8 +83,7 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
$(document).ready(loadSlideshow);
|
|
||||||
</script>
|
</script>
|
||||||
{% block end %}
|
{% block end %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
<title>{{ content.title }} - Studio CAMP</title>
|
|
||||||
<meta name="title" content="{{ content.title }}"/>
|
|
||||||
<meta property="og:title" content="{{ content.title }}"/>
|
|
||||||
<meta content="https://studio.camp{{ content.image_url }}" name="thumbnail"/>
|
|
||||||
<meta content="https://studio.camp{{ content.image_url }}" name="image_src"/>
|
|
||||||
<meta property="og:image" content="https://studio.camp{{ content.image_url }}"/>
|
|
|
@ -1,7 +1,4 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% block head %}
|
|
||||||
{% include "content-header.html" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "edit.html" %}
|
{% include "edit.html" %}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% block head %}
|
|
||||||
{% include "content-header.html" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% include "featured.html" %}
|
{% include "featured.html" %}
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
<ul class="slider1">
|
<ul class="slider1">
|
||||||
{% for photo in gallery.public %}
|
{% for photo in gallery.public %}
|
||||||
<li id="slide-{{photo.slug}}">
|
<li id="slide-{{photo.slug}}">
|
||||||
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}" loading="lazy">
|
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
|
||||||
<p>
|
<p>
|
||||||
{{ photo.caption|safe }}
|
{{ photo.caption|safe }}
|
||||||
{% if photo.caption %}<br>{%endif%}
|
{% if photo.caption %}<br>{%endif%}
|
||||||
<a href="{{ photo.image.url }}" class="original-link" target="_blank" >Link to original file</a>
|
<a href="{{ photo.image.url }}" target="_blank" >Link to original file</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<p>
|
<p>
|
||||||
{{ object.caption|safe }}
|
{{ object.caption|safe }}
|
||||||
{% if object.caption %}<br>{%endif%}
|
{% if object.caption %}<br>{%endif%}
|
||||||
<a href="{{ object.image.url }}" class="original-link" target="_blank" >Link to original file</a>
|
<a href="{{ object.image.url }}" target="_blank" >Link to original file</a>
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
{% for gallery in object.public_galleries %}
|
{% for gallery in object.public_galleries %}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from django import template
|
from django import template
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.html import mark_safe
|
|
||||||
|
|
||||||
from ..models import Content
|
from ..models import Content
|
||||||
|
|
||||||
|
@ -19,27 +18,3 @@ def available_content():
|
||||||
type.upper()
|
type.upper()
|
||||||
])
|
])
|
||||||
return sections
|
return sections
|
||||||
|
|
||||||
@register.filter
|
|
||||||
def admin_thumbnail(row):
|
|
||||||
from photologue.models import Photo
|
|
||||||
p = None
|
|
||||||
if 'for="id_photos_' in row.get('label_for'):
|
|
||||||
try:
|
|
||||||
p = Photo.objects.get(pk=row['option_value'])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
elif 'for="id_related_content_' in row.get('label_for'):
|
|
||||||
try:
|
|
||||||
p = Content.objects.get(pk=row['option_value'])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
print(row)
|
|
||||||
|
|
||||||
if p:
|
|
||||||
try:
|
|
||||||
return mark_safe(p.admin_thumbnail() + ' ')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
return ''
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -9,7 +9,6 @@ from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||||
from django.db.models import Q, Count
|
from django.db.models import Q, Count
|
||||||
from django.db.models.functions import Coalesce
|
|
||||||
from django.http import HttpResponse, Http404
|
from django.http import HttpResponse, Http404
|
||||||
from django.shortcuts import get_object_or_404, render, redirect
|
from django.shortcuts import get_object_or_404, render, redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -24,24 +23,14 @@ from . import forms
|
||||||
|
|
||||||
ITEMS_PER_PAGE = 30
|
ITEMS_PER_PAGE = 30
|
||||||
|
|
||||||
def get_events(base):
|
|
||||||
now = datetime.now() - timedelta(hours=24)
|
|
||||||
now = datetime.now().date()
|
|
||||||
upcoming_events = base.filter(datestart__gte=now).order_by('datestart')[: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))
|
|
||||||
#past_events.annotate(datesort=Coalesce('dateend', 'datestart')).order_by('-datesort')[:12]
|
|
||||||
past_events = past_events.order_by('-datestart')[:12]
|
|
||||||
#past_events = list(past_events)
|
|
||||||
#past_events.sort(key=lambda event: event.dateend if event.dateend else event.datestart, reverse=True)
|
|
||||||
return upcoming_events, ongoing_events, past_events
|
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
|
now = datetime.now()
|
||||||
display_events = ['news', 'events']
|
display_events = ['news', 'events']
|
||||||
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)
|
||||||
upcoming_events, ongoing_events, past_events = get_events(base)
|
upcoming_events = base.filter(datestart__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]
|
||||||
|
|
||||||
homepage = Content.objects.filter(type__name='homepage').order_by('-datestart')[:1]
|
homepage = Content.objects.filter(type__name='homepage').order_by('-datestart')[:1]
|
||||||
context = {
|
context = {
|
||||||
|
@ -84,7 +73,7 @@ def section_index(request, section, max_length=10):
|
||||||
def content_years(content):
|
def content_years(content):
|
||||||
years = [
|
years = [
|
||||||
year['year'].year
|
year['year'].year
|
||||||
for year in content.exclude(datestart=None).annotate(year=TruncYear('datestart')).values('year').annotate(count=Count('shortname')).order_by('-year')
|
for year in content.annotate(year=TruncYear('datestart')).values('year').annotate(count=Count('shortname')).order_by('-year')
|
||||||
]
|
]
|
||||||
return years
|
return years
|
||||||
|
|
||||||
|
@ -92,10 +81,9 @@ def filter_by_years(content, year):
|
||||||
years = content_years(content)
|
years = content_years(content)
|
||||||
if year.isdigit():
|
if year.isdigit():
|
||||||
year = int(year)
|
year = int(year)
|
||||||
elif years:
|
else:
|
||||||
year = years[0]
|
year = years[0]
|
||||||
if year:
|
content = content.filter(datestart__gte='%s-01-01' % year, datestart__lt='%s-01-01' % (year+1))
|
||||||
content = content.filter(datestart__gte='%04d-01-01' % year, datestart__lt='%04d-01-01' % (year+1))
|
|
||||||
return {
|
return {
|
||||||
'content': content,
|
'content': content,
|
||||||
'year': year,
|
'year': year,
|
||||||
|
@ -136,6 +124,7 @@ def section_list(request, section):
|
||||||
return render(request, 'results.html', context)
|
return render(request, 'results.html', context)
|
||||||
|
|
||||||
def event(request):
|
def event(request):
|
||||||
|
now = datetime.now()
|
||||||
display_events = ['events', 'news']
|
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')
|
||||||
|
@ -143,7 +132,9 @@ def event(request):
|
||||||
if featured:
|
if featured:
|
||||||
base = base.exclude(pk=featured[0].pk)
|
base = base.exclude(pk=featured[0].pk)
|
||||||
|
|
||||||
upcoming_events, ongoing_events, past_events = get_events(base)
|
upcoming_events = base.filter(datestart__gt=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)).order_by('-datestart')[:10]
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'upcoming_events': upcoming_events,
|
'upcoming_events': upcoming_events,
|
||||||
|
@ -159,7 +150,6 @@ def get_related_content(types, current=None, max_length=10):
|
||||||
latest_content_list = Content.objects.filter(type__name__in=types).order_by('-datestart')
|
latest_content_list = Content.objects.filter(type__name__in=types).order_by('-datestart')
|
||||||
if current:
|
if current:
|
||||||
latest_content_list = latest_content_list.exclude(pk=current.pk)
|
latest_content_list = latest_content_list.exclude(pk=current.pk)
|
||||||
latest_content_list = latest_content_list.exclude(pk__in=current.related_content.all())
|
|
||||||
latest_content_list = latest_content_list.filter(published=True)
|
latest_content_list = latest_content_list.filter(published=True)
|
||||||
more = latest_content_list.count() > max_length
|
more = latest_content_list.count() > max_length
|
||||||
latest_content_list = latest_content_list[:max_length]
|
latest_content_list = latest_content_list[:max_length]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user