tweaks
This commit is contained in:
parent
25db5b2868
commit
2b129a8596
|
@ -63,7 +63,9 @@ 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': [
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
.slider1 {
|
||||||
|
display: none;
|
||||||
|
}
|
|
@ -1386,7 +1386,8 @@
|
||||||
} 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()) {
|
||||||
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
// fails with slow connections
|
||||||
|
//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) {
|
||||||
|
|
|
@ -143,10 +143,25 @@ 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:
|
||||||
return self.photo.get_display_url()
|
url = self.photo.image.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
|
||||||
|
|
|
@ -51,8 +51,8 @@
|
||||||
<script src="{% static "js/what-input.js" %}"></script>
|
<script src="{% static "js/what-input.js" %}"></script>
|
||||||
<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(){
|
function loadSlideshow() {
|
||||||
slider = $('.slider1').bxSlider({
|
slider = $('.slider1').show().bxSlider({
|
||||||
adaptiveHeight : true,
|
adaptiveHeight : true,
|
||||||
pager : false,
|
pager : false,
|
||||||
});
|
});
|
||||||
|
@ -83,7 +83,8 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
$(document).ready(loadSlideshow);
|
||||||
</script>
|
</script>
|
||||||
{% block end %}
|
{% block end %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
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
|
||||||
|
|
||||||
|
@ -18,3 +19,27 @@ 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 ''
|
||||||
|
|
|
@ -150,6 +150,7 @@ 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