Merge branch 'psql'

This commit is contained in:
j 2017-12-19 13:01:17 +01:00
commit 9f33c16619
52 changed files with 3398 additions and 616 deletions

8
.gitignore vendored
View File

@ -1,2 +1,10 @@
static
data
*.pyc *.pyc
__pycache__
venv
local_settings.py local_settings.py
camp.json
*.swp
*.swo
secret.txt

4
README.md Normal file
View File

@ -0,0 +1,4 @@
setup venv:
virtualenv --system-site-packages venv

View File

@ -15,7 +15,6 @@ import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
@ -34,12 +33,20 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django.contrib.sites',
'braces',
'django_extensions', 'django_extensions',
'markdownx',
'photologue',
'sortedm2m',
'camp',
'content', 'content',
] ]
SITE_ID = 1
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
@ -56,13 +63,19 @@ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], 'DIRS': [],
'APP_DIRS': True, 'APP_DIRS': False,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
'django.template.context_processors.debug', 'django.template.context_processors.debug',
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'django.template.context_processors.media',
],
'loaders': [
'app_namespace.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
], ],
}, },
}, },
@ -76,10 +89,9 @@ WSGI_APPLICATION = 'camp.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'camp', 'NAME': 'camp',
'USER': 'root', 'USER': '',
'PASSWORD': 'sqlsql'
} }
} }
@ -116,12 +128,19 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/ # https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MARKDOWNX_MEDIA_PATH = 'images/markdown'
MARKDOWNX_EDITOR_RESIZABLE = True
MEDIA_URL = '/static/images/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'data/images')
IMAGE_PREFIX = 'http://studio.camp/images/' IMAGE_PREFIX = 'http://studio.camp/images/'

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -14,6 +14,8 @@
* 3. Prevent adjustments of font size after orientation changes in * 3. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS. * IE on Windows Phone and in iOS.
*/ */
html { html {
font-family: sans-serif; font-family: sans-serif;
/* 1 */ /* 1 */
@ -3528,16 +3530,14 @@ table {
text-align: left; } text-align: left; }
table tbody th, table tbody th,
table tbody td { table tbody td {
padding: 0.5rem 0.625rem 0.625rem; } padding: 0.25rem 0.25rem 0.25rem; }
table tbody tr:nth-child(even) { table tbody tr:nth-child(even) {
border-bottom: 0; border-bottom: 0;
background-color: #f1f1f1; } }
table.unstriped tbody {
background-color: #fefefe; }
table.unstriped tbody tr { table.unstriped tbody tr {
border-bottom: 0; border-bottom: 0;
border-bottom: 1px solid #f1f1f1; border-bottom: 1px;
background-color: #fefefe; } }
@media screen and (max-width: 63.9375em) { @media screen and (max-width: 63.9375em) {
table.stack thead { table.stack thead {
@ -3636,10 +3636,7 @@ table.hover:not(.unstriped) tr:nth-of-type(even):hover {
.thumbnail { .thumbnail {
display: inline-block; display: inline-block;
max-width: 100%; max-width: 100%;
margin-bottom: 1rem; margin-bottom: 0.2rem;
border: solid 4px #fefefe;
border-radius: 0;
box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.2);
line-height: 0; } line-height: 0; }
a.thumbnail { a.thumbnail {

View File

@ -0,0 +1,170 @@
/** VARIABLES
===================================*/
/** RESET AND LAYOUT
===================================*/
.bx-wrapper {
position: relative;
margin-bottom: 60px;
padding: 0;
*zoom: 1;
-ms-touch-action: pan-y;
touch-action: pan-y;
}
.bx-wrapper img {
max-width: 100%;
display: block;
}
.bxslider {
margin: 0;
padding: 0;
}
ul.bxslider {
list-style: none;
}
.bx-viewport {
/*fix other elements on the page moving (on Chrome)*/
-webkit-transform: translatez(0);
}
/** THEME
===================================*/
.bx-wrapper .bx-pager,
.bx-wrapper .bx-controls-auto {
position: absolute;
bottom: -30px;
width: 100%;
}
/* LOADER */
.bx-wrapper .bx-loading {
min-height: 50px;
height: auto;
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2000;
}
/* PAGER */
.bx-wrapper .bx-pager {
text-align: center;
font-size: .85em;
font-family: Arial;
font-weight: bold;
color: #666;
padding-top: 20px;
}
.bx-wrapper .bx-pager.bx-default-pager a {
background: #666;
text-indent: -9999px;
display: block;
width: 10px;
height: 10px;
margin: 0 5px;
outline: 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.bx-wrapper .bx-pager.bx-default-pager a:hover,
.bx-wrapper .bx-pager.bx-default-pager a.active,
.bx-wrapper .bx-pager.bx-default-pager a:focus {
background: #000;
}
.bx-wrapper .bx-pager-item,
.bx-wrapper .bx-controls-auto .bx-controls-auto-item {
display: inline-block;
vertical-align: bottom;
*zoom: 1;
*display: inline;
}
.bx-wrapper .bx-pager-item {
font-size: 0;
line-height: 0;
}
/* DIRECTION CONTROLS (NEXT / PREV) */
.bx-wrapper .bx-prev {
left: 10px;
background: url('controls.png') no-repeat 0 -32px;
}
.bx-wrapper .bx-prev:hover,
.bx-wrapper .bx-prev:focus {
background-position: 0 0;
}
.bx-wrapper .bx-next {
right: 30px;
background: url('controls.png') no-repeat -43px -32px;
}
.bx-wrapper .bx-next:hover,
.bx-wrapper .bx-next:focus {
background-position: -43px 0;
}
.bx-wrapper .bx-controls-direction a {
position: absolute;
top: 50%;
margin-top: -16px;
outline: 0;
width: 32px;
height: 32px;
text-indent: -9999px;
z-index: 9999;
}
.bx-wrapper .bx-controls-direction a.disabled {
display: none;
}
/* AUTO CONTROLS (START / STOP) */
.bx-wrapper .bx-controls-auto {
text-align: center;
}
.bx-wrapper .bx-controls-auto .bx-start {
display: block;
text-indent: -9999px;
width: 10px;
height: 11px;
outline: 0;
background: url('images/controls.png') -86px -11px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-start:hover,
.bx-wrapper .bx-controls-auto .bx-start.active,
.bx-wrapper .bx-controls-auto .bx-start:focus {
background-position: -86px 0;
}
.bx-wrapper .bx-controls-auto .bx-stop {
display: block;
text-indent: -9999px;
width: 9px;
height: 11px;
outline: 0;
background: url('images/controls.png') -86px -44px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-stop:hover,
.bx-wrapper .bx-controls-auto .bx-stop.active,
.bx-wrapper .bx-controls-auto .bx-stop:focus {
background-position: -86px -33px;
}
/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
text-align: left;
width: 80%;
}
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto {
right: 0;
width: 35px;
}
/* IMAGE CAPTIONS */
.bx-wrapper .bx-caption {
position: absolute;
bottom: 0;
left: 0;
background: #666;
background: rgba(80, 80, 80, 0.75);
width: 100%;
}
.bx-wrapper .bx-caption span {
color: #fff;
font-family: Arial;
display: block;
font-size: .85em;
padding: 10px;
}

144
camp/static/css/main.css Normal file
View File

@ -0,0 +1,144 @@
body {
background-color: #000000 !important;
font-size: 14px !important;
color: #ffffff !important;
overflow-x: hidden;
}
.content_detail {
width: 70%;
padding-left: 5%;
}
.right-items {
padding-bottom: 0.5em;
padding-top: 0.5em;
}
body, h1, h2, h3, h4, h5, h6 {
font-family: Open Sans !important;
}
.sidebar-h4 {
font-weight: 600;
text-transform: uppercase;
font-size: 14px;
color: #ffffff;
}
.sidebar-title {
text-transform: capitalize;
font-weight: 800;
font-style: italic;
font-size: 14px;
color: #1779ba;
}
.sidebar-title :hover {
color: #ffffff;
}
a:focus, a:hover {
color: #ffffff !important;
}
.sidebar-date {
text-transform: uppercase;
font-size: 10px;
}
.news {
padding-left: 10px;
}
.special-column {
padding-left: 0em !important;
}
.index-text {
padding-left: 3%;
padding-right: 1%;
padding-top: 10px;
}
.index-text p {
text-align: justify;
}
.title-bar-right {
margin-right: 2em;
margin-top: 1em;
}
.menu-icon::after{
background: #ffffff none repeat scroll 0 0 !important;
box-shadow: 0 7px 0 #ffffff, 0 14px 0 #ffffff !important;
}
.big-title {
color: #ffffff;
font-weight: 600;
font-size: 1em;
}
.big-date {
font-size: 1em;
text-transform: uppercase;
}
.vertical-menu li {
list-style: none;
padding-top: 2em;
padding-left: 1em;
font-weight: 600;
font-size: 1em;
color: #ef4e5c;
background-color: #dddddd;
}
.off-canvas {
background-color: #dddddd !important;
}
.position-right.is-transition-push::after {
box-shadow: none !important;
}
ul.clearing-thumbs li {
list-style: none;
display: inline;
padding-right: 3px;
}
.page-header {
margin-top: 30px;
padding-bottom: 20px;
}
.thumbnail {
border: none;
}
.results {
padding: 20px;
}
.results-title {
padding-top: 20px;
padding-left: 20px;
}
.pagination {
padding-bottom: 20px;
}
.pagination a, .pagination button {
color: #ffffff !important;
}
.pagination a:hover,
.pagination button:hover {
background: #1779ba !important; }

View File

@ -0,0 +1,33 @@
/**
* Here's where everything gets included. You don't need
* to change anything here, and doing so might break
* stuff. Here be dragons and all that.
*/
/**
* Default variables
*
* While these can be set with JavaScript, it's probably
* better and faster to just set them here, compile to
* CSS and include that instead to use some of that
* hardware-accelerated goodness.
*/
.unslider-nav ol {
list-style: none;
text-align: center;
}
.unslider-nav ol li {
display: inline-block;
width: 6px;
height: 6px;
margin: 0 4px;
background: transparent;
border-radius: 5px;
overflow: hidden;
text-indent: -999em;
border: 2px solid #fff;
cursor: pointer;
}
.unslider-nav ol li.unslider-active {
background: #fff;
cursor: default;
}

1
camp/static/css/unslider.css Executable file
View File

@ -0,0 +1 @@
.unslider{overflow:auto;margin:0;padding:0}.unslider-wrap{position:relative}.unslider-wrap.unslider-carousel>li{float:left}.unslider-vertical>ul{height:100%}.unslider-vertical li{float:none;width:100%}.unslider-fade{position:relative}.unslider-fade .unslider-wrap li{position:absolute;left:0;top:0;right:0;z-index:8}.unslider-fade .unslider-wrap li.unslider-active{z-index:10}.unslider li,.unslider ol,.unslider ul{list-style:none;margin:0;padding:0;border:none}.unslider-arrow{position:absolute;left:20px;z-index:2;cursor:pointer}.unslider-arrow.next{left:auto;right:20px}

File diff suppressed because it is too large Load Diff

1
camp/static/js/unslider.min.js vendored Executable file
View File

@ -0,0 +1 @@
(function(e,t){if(!e)return t;var n=function(){this.el=t;this.items=t;this.sizes=[];this.max=[0,0];this.current=0;this.interval=t;this.opts={speed:500,delay:3e3,complete:t,keys:!t,dots:t,fluid:t};var n=this;this.init=function(t,n){this.el=t;this.ul=t.children("ul");this.max=[t.outerWidth(),t.outerHeight()];this.items=this.ul.children("li").each(this.calculate);this.opts=e.extend(this.opts,n);this.setup();return this};this.calculate=function(t){var r=e(this),i=r.outerWidth(),s=r.outerHeight();n.sizes[t]=[i,s];if(i>n.max[0])n.max[0]=i;if(s>n.max[1])n.max[1]=s};this.setup=function(){this.el.css({overflow:"hidden",width:n.max[0],height:this.items.first().outerHeight()});this.ul.css({width:this.items.length*100+"%",position:"relative"});this.items.css("width",100/this.items.length+"%");if(this.opts.delay!==t){this.start();this.el.hover(this.stop,this.start)}this.opts.keys&&e(document).keydown(this.keys);this.opts.dots&&this.dots();if(this.opts.fluid){var r=function(){n.el.css("width",Math.min(Math.round(n.el.outerWidth()/n.el.parent().outerWidth()*100),100)+"%")};r();e(window).resize(r)}if(this.opts.arrows){this.el.parent().append('<p class="arrows"><span class="prev">←</span><span class="next">→</span></p>').find(".arrows span").click(function(){e.isFunction(n[this.className])&&n[this.className]()})}if(e.event.swipe){this.el.on("swipeleft",n.prev).on("swiperight",n.next)}};this.move=function(t,r){if(!this.items.eq(t).length)t=0;if(t<0)t=this.items.length-1;var i=this.items.eq(t);var s={height:i.outerHeight()};var o=r?5:this.opts.speed;if(!this.ul.is(":animated")){n.el.find(".dot:eq("+t+")").addClass("active").siblings().removeClass("active");this.el.animate(s,o)&&this.ul.animate(e.extend({left:"-"+t+"00%"},s),o,function(i){n.current=t;e.isFunction(n.opts.complete)&&!r&&n.opts.complete(n.el)})}};this.start=function(){n.interval=setInterval(function(){n.move(n.current+1)},n.opts.delay)};this.stop=function(){n.interval=clearInterval(n.interval);return n};this.keys=function(t){var r=t.which;var i={37:n.prev,39:n.next,27:n.stop};if(e.isFunction(i[r])){i[r]()}};this.next=function(){return n.stop().move(n.current+1)};this.prev=function(){return n.stop().move(n.current-1)};this.dots=function(){var t='<ol class="dots">';e.each(this.items,function(e){t+='<li class="dot'+(e<1?" active":"")+'">'+(e+1)+"</li>"});t+="</ol>";this.el.addClass("has-dots").append(t).find(".dot").click(function(){n.move(e(this).index())})}};e.fn.unslider=function(t){var r=this.length;return this.each(function(i){var s=e(this);var u=(new n).init(s,t);s.data("unslider"+(r>1?"-"+(i+1):""),u)})}})(window.jQuery,false)

View File

@ -13,13 +13,19 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf.urls import url from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.views.generic import RedirectView from django.views.generic import RedirectView
from markdownx import urls as markdownx
from photologue.views import GalleryListView
from content import views from content import views
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
@ -28,16 +34,26 @@ urlpatterns = [
url(r'^.*event.php$', views.redirect_event, name='redirect_event'), url(r'^.*event.php$', views.redirect_event, name='redirect_event'),
url(r'^.*(/images/.*)$', views.redirect_images, name='redirect_images'), url(r'^.*(/images/.*)$', views.redirect_images, name='redirect_images'),
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'^projects/', views.projects, name='projects'), url(r'^texts/(?P<shortname>.+)/$', views.texts, name='texts'),
url(r'^events/', views.events, name='events'), url(r'^events/(?P<shortname>.+)/$', views.events, name='events'),
url(r'^works/', views.works, name='works'), url(r'^projects/(?P<shortname>.+)/$', views.projects, name='projects'),
url(r'^texts/', views.texts, name='texts'), url(r'^works/(?P<shortname>.+)/$', views.works, name='works'),
url(r'^works/$', views.works),
url(r'^about/', views.about, name='about'), url(r'^projects/$', views.projects),
url(r'^contact/', views.contact, name='contact'), url(r'^events/$', views.events),
url(r'^texts/$', views.texts),
url(r'^search/$', views.search),
url(r'^(?P<shortname>.+)/$', views.content, name='content'), url(r'^markdownx/', include(markdownx)),
url(r'^photologue/', include('photologue.urls', namespace='photologue')),
url(r'^gallerylist/$', GalleryListView.as_view(), name='gallery-list'),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += [
url(r'^(?P<shortname>\w+)/$', views.page, name='page')
] ]

View File

@ -1,10 +1,29 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django import forms
from django.contrib import admin from django.contrib import admin
from markdownx.admin import MarkdownxModelAdmin
from markdownx.widgets import AdminMarkdownxWidget
# Register your models here. # Register your models here.
from . import models from models import *
from photologue.admin import GalleryAdmin as GalleryAdminDefault
from photologue.models import Gallery
class ContentParentsInline(admin.TabularInline):
model = ContentContent
fk_name = 'contentid2'
raw_id_fields = ['contentid1']
class ImagesInline(admin.StackedInline):
model = Image
class FileInline(admin.StackedInline):
model = File
class LinkInline(admin.StackedInline):
model = Link
''' '''
class SubdomainInline(admin.StackedInline): class SubdomainInline(admin.StackedInline):
@ -17,31 +36,34 @@ class ServerAdmin(admin.ModelAdmin):
pass pass
''' '''
class ResourcesAdmin(admin.ModelAdmin): class GalleryAdminForm(forms.ModelForm):
list_display = ('__unicode__', 'type', 'mime') """Users never need to enter a description on a gallery."""
search_fields = ['href']
list_filter = ['type', 'mime']
admin.site.register(models.Resources, ResourcesAdmin) class Meta:
model = Gallery
exclude = ['description']
class ResourcesInline(admin.StackedInline): class GalleryAdmin(GalleryAdminDefault):
model = models.ContentResource form = GalleryAdminForm
extra = 2 # how many rows to show
class ContentAdmin(admin.ModelAdmin): class ContentAdmin(admin.ModelAdmin):
save_on_top = True save_on_top = True
list_display = ('__unicode__', 'datestart', 'type') list_display = ('__unicode__', 'datestart', 'shortname', 'type')
list_filter = ['datestart', 'type', 'view', 'published'] list_filter = ['datestart', 'type']
search_fields = ['title', 'body', 'header'] search_fields = ['title', 'body', 'header', 'shortname']
raw_id_fields = ['parent'] inlines = [ContentParentsInline, ImagesInline, FileInline, LinkInline]
formfield_overrides = {
models.TextField: {'widget': AdminMarkdownxWidget},
}
inlines = (ResourcesInline,)
# inlines = [SubdomainInline, DomainAliasInline] # inlines = [SubdomainInline, DomainAliasInline]
# list_display = ('url', 'server', 'manage_nameserver', 'domain_registrar', 'email', 'is_active') # list_display = ('url', 'server', 'manage_nameserver', 'domain_registrar', 'email', 'is_active')
# list_editable = ('server', 'manage_nameserver', 'domain_registrar', 'email', 'is_active') # list_editable = ('server', 'manage_nameserver', 'domain_registrar', 'email', 'is_active')
admin.site.register(models.Content, ContentAdmin) admin.site.register(Content, ContentAdmin)
admin.site.unregister(Gallery)
admin.site.register(Gallery, GalleryAdmin)

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-23 09:35 # Generated by Django 1.11.1 on 2017-06-10 11:51
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -21,7 +22,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'acrolike', 'db_table': 'acrolike',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -36,7 +36,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'acronym', 'db_table': 'acronym',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -49,7 +48,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'audios', 'db_table': 'audios',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -68,6 +66,35 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'comments', 'db_table': 'comments',
},
),
migrations.CreateModel(
name='Content',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('shortname', models.CharField(db_column='shortName', max_length=255)),
('title', models.CharField(max_length=255)),
('header', models.TextField(blank=True, null=True)),
('body', models.TextField(blank=True, null=True)),
('schedule', models.TextField(blank=True, null=True)),
('schedulebutton', models.CharField(blank=True, db_column='scheduleButton', max_length=255, null=True)),
('optbtn2', models.CharField(blank=True, db_column='optBtn2', max_length=127, null=True)),
('opttext2', models.TextField(blank=True, db_column='optText2', null=True)),
('optbtn3', models.CharField(blank=True, db_column='optBtn3', max_length=127, null=True)),
('opttext3', models.TextField(blank=True, db_column='optText3', null=True)),
('technotes', models.TextField(blank=True, db_column='technotes', null=True)),
('image', models.CharField(blank=True, max_length=150, null=True)),
('postedby', models.CharField(blank=True, db_column='postedBy', max_length=50, null=True)),
('datestart', models.DateField(blank=True, db_column='dateStart', null=True)),
('dateend', models.DateField(blank=True, db_column='dateEnd', null=True)),
('dateadded', models.DateTimeField(db_column='dateAdded')),
('datemodified', models.DateTimeField(blank=True, db_column='dateModified', null=True)),
('published', models.IntegerField()),
('place', models.CharField(blank=True, max_length=255, null=True)),
('parentid', models.IntegerField(blank=True, db_column='parentID', null=True)),
],
options={
'db_table': 'content',
'managed': True, 'managed': True,
}, },
), ),
@ -75,12 +102,11 @@ class Migration(migrations.Migration):
name='ContentContent', name='ContentContent',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('contentid1', models.IntegerField(db_column='contentID1')), ('contentid1', models.ForeignKey(db_column='contentID1', on_delete=django.db.models.deletion.CASCADE, related_name='child', to='content.Content')),
('contentid2', models.IntegerField(db_column='contentID2')), ('contentid2', models.ForeignKey(db_column='contentID2', on_delete=django.db.models.deletion.CASCADE, related_name='parent', to='content.Content')),
], ],
options={ options={
'db_table': 'content_content', 'db_table': 'content_content',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -92,7 +118,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'content_keyword', 'db_table': 'content_keyword',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -104,7 +129,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'content_resource', 'db_table': 'content_resource',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -116,9 +140,30 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'content_types', 'db_table': 'content_types',
'managed': True,
}, },
), ),
migrations.CreateModel(
name='File',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('fil', models.FileField(upload_to='files')),
('description', models.TextField(blank=True, null=True)),
('date', models.DateTimeField(auto_now_add=True)),
('order', models.IntegerField(blank=True, null=True)),
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='content.Content')),
],
),
migrations.CreateModel(
name='Image',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.ImageField(upload_to='images')),
('description', models.TextField(blank=True, null=True)),
('date', models.DateTimeField(auto_now_add=True)),
('order', models.IntegerField(blank=True, null=True)),
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='content.Content')),
],
),
migrations.CreateModel( migrations.CreateModel(
name='Keywords', name='Keywords',
fields=[ fields=[
@ -128,9 +173,19 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'keywords', 'db_table': 'keywords',
'managed': True,
}, },
), ),
migrations.CreateModel(
name='Link',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.URLField()),
('description', models.TextField(blank=True, null=True)),
('date', models.DateTimeField(auto_now_add=True)),
('order', models.IntegerField(blank=True, null=True)),
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='content.Content')),
],
),
migrations.CreateModel( migrations.CreateModel(
name='People', name='People',
fields=[ fields=[
@ -146,7 +201,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'people', 'db_table': 'people',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -159,7 +213,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'person_content', 'db_table': 'person_content',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -171,7 +224,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'person_resource', 'db_table': 'person_resource',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -185,12 +237,11 @@ class Migration(migrations.Migration):
('width', models.IntegerField(blank=True, null=True)), ('width', models.IntegerField(blank=True, null=True)),
('height', models.IntegerField(blank=True, null=True)), ('height', models.IntegerField(blank=True, null=True)),
('istech', models.IntegerField(db_column='isTech')), ('istech', models.IntegerField(db_column='isTech')),
('dateadded', models.DateTimeField(db_column='dateAdded')), ('dateadded', models.DateTimeField(blank=True, db_column='dateAdded', null=True)),
('orderno', models.IntegerField(blank=True, db_column='orderNo', null=True)), ('orderno', models.IntegerField(blank=True, db_column='orderNo', null=True)),
], ],
options={ options={
'db_table': 'resources', 'db_table': 'resources',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -210,7 +261,6 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'videos', 'db_table': 'videos',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -222,39 +272,21 @@ class Migration(migrations.Migration):
], ],
options={ options={
'db_table': 'views', 'db_table': 'views',
'managed': True,
}, },
), ),
migrations.CreateModel( migrations.AddField(
name='Content', model_name='content',
fields=[ name='parents',
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), field=models.ManyToManyField(related_name='children', through='content.ContentContent', to='content.Content'),
('shortname', models.CharField(db_column='shortName', max_length=255)), ),
('title', models.CharField(max_length=255)), migrations.AddField(
('header', models.TextField(blank=True, null=True)), model_name='content',
('body', models.TextField(blank=True, null=True)), name='type',
('schedule', models.TextField(blank=True, null=True)), field=models.ForeignKey(db_column='type', on_delete=django.db.models.deletion.CASCADE, to='content.ContentTypes'),
('schedulebutton', models.CharField(blank=True, db_column='scheduleButton', max_length=255, null=True)), ),
('optbtn2', models.CharField(blank=True, db_column='optBtn2', max_length=127, null=True)), migrations.AddField(
('opttext2', models.TextField(blank=True, db_column='optText2', null=True)), model_name='content',
('optbtn3', models.CharField(blank=True, db_column='optBtn3', max_length=127, null=True)), name='view',
('opttext3', models.TextField(blank=True, db_column='optText3', null=True)), field=models.ForeignKey(blank=True, db_column='view', null=True, on_delete=django.db.models.deletion.CASCADE, to='content.Views'),
('technotes', models.TextField()),
('image', models.CharField(blank=True, max_length=150, null=True)),
('postedby', models.CharField(blank=True, db_column='postedBy', max_length=50, null=True)),
('datestart', models.DateField(blank=True, db_column='dateStart', null=True)),
('dateend', models.DateField(blank=True, db_column='dateEnd', null=True)),
('dateadded', models.DateTimeField(db_column='dateAdded')),
('datemodified', models.DateTimeField(blank=True, db_column='dateModified', null=True)),
('type', models.IntegerField()),
('published', models.IntegerField()),
('view', models.IntegerField(blank=True, null=True)),
('place', models.CharField(max_length=255)),
('parentid', models.IntegerField(db_column='parentId')),
],
options={
'db_table': 'content',
'managed': True,
},
), ),
] ]

View File

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-21 09:15
from __future__ import unicode_literals
from django.db import migrations, models
import markdownx.models
class Migration(migrations.Migration):
dependencies = [
('content', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='MyModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('myfield', markdownx.models.MarkdownxField()),
],
),
migrations.AlterField(
model_name='content',
name='body',
field=markdownx.models.MarkdownxField(),
),
migrations.AlterField(
model_name='content',
name='header',
field=markdownx.models.MarkdownxField(),
),
migrations.AlterField(
model_name='image',
name='image',
field=models.ImageField(upload_to='camp/static/images'),
),
]

View File

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-18 11:03
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('content', '0002_auto_20170621_0915'),
]
operations = [
migrations.AddField(
model_name='content',
name='teaser',
field=models.TextField(blank=True, null=True, validators=[django.core.validators.MaxLengthValidator(200)]),
),
migrations.AlterField(
model_name='content',
name='dateadded',
field=models.DateTimeField(auto_now_add=True, db_column='dateAdded'),
),
migrations.AlterField(
model_name='content',
name='datemodified',
field=models.DateTimeField(auto_now=True, db_column='dateModified', null=True),
),
migrations.AlterField(
model_name='content',
name='published',
field=models.IntegerField(default=0),
),
migrations.AlterField(
model_name='content',
name='view',
field=models.ForeignKey(blank=True, db_column='view', editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='content.Views'),
),
]

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-18 11:49
from __future__ import unicode_literals
from django.db import migrations, models
import markdownx.models
class Migration(migrations.Migration):
dependencies = [
('content', '0003_auto_20171218_1103'),
]
operations = [
migrations.AddField(
model_name='content',
name='featured',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='content',
name='header',
field=markdownx.models.MarkdownxField(blank=True, default='', null=True),
),
migrations.AlterField(
model_name='content',
name='published',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,85 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-19 10:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import markdownx.models
class Migration(migrations.Migration):
dependencies = [
('content', '0004_auto_20171218_1149'),
]
operations = [
migrations.RunSQL(
[
('delete from content_resource where "resourceID" not in (select id from resources);', None),
('delete from content_resource where "contentID" not in (select id from content);', None),
('delete from person_content where "personID" not in (select id from people);', None),
('delete from person_content where "contentID" not in (select id from content);', None),
]
),
migrations.AddField(
model_name='content',
name='resources',
field=models.ManyToManyField(related_name='content', through='content.ContentResource', to='content.Resources'),
),
migrations.AddField(
model_name='people',
name='content',
field=models.ManyToManyField(related_name='people', through='content.PersonContent', to='content.Content'),
),
migrations.AddField(
model_name='people',
name='resources',
field=models.ManyToManyField(related_name='people', through='content.PersonResource', to='content.Resources'),
),
migrations.AlterField(
model_name='content',
name='body',
field=markdownx.models.MarkdownxField(blank=True, default='', null=True),
),
migrations.AlterField(
model_name='content',
name='parentid',
field=models.IntegerField(blank=True, db_column='parentID', editable=False, null=True),
),
migrations.AlterField(
model_name='contentresource',
name='contentid',
field=models.ForeignKey(db_column='contentID', on_delete=django.db.models.deletion.CASCADE, to='content.Content'),
),
migrations.AlterField(
model_name='contentresource',
name='resourceid',
field=models.ForeignKey(db_column='resourceID', on_delete=django.db.models.deletion.CASCADE, to='content.Resources'),
),
migrations.AlterField(
model_name='personcontent',
name='contentid',
field=models.ForeignKey(db_column='contentID', on_delete=django.db.models.deletion.CASCADE, to='content.Content'),
),
migrations.AlterField(
model_name='personcontent',
name='personid',
field=models.ForeignKey(db_column='personID', on_delete=django.db.models.deletion.CASCADE, to='content.People'),
),
migrations.AlterField(
model_name='personresource',
name='personid',
field=models.ForeignKey(db_column='personID', on_delete=django.db.models.deletion.CASCADE, to='content.People'),
),
migrations.AlterField(
model_name='personresource',
name='resourceid',
field=models.ForeignKey(db_column='resourceID', on_delete=django.db.models.deletion.CASCADE, to='content.Resources'),
),
migrations.AlterField(
model_name='resources',
name='type',
field=models.IntegerField(choices=[(1, 'Resources'), (2, 'Images'), (3, 'Links')]),
),
]

View File

@ -2,59 +2,264 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf import settings from django.conf import settings
from django.core.validators import MaxLengthValidator
from django.db import models from django.db import models
from django.urls import reverse from django.utils.html import mark_safe
from photologue.models import Photo, Gallery
from markdownx.models import MarkdownxField
from markdownx.utils import markdownify
import ox
# Create your models here.
class Acrolike(models.Model):
title = models.CharField(max_length=255)
class Meta:
# managed = False
db_table = 'acrolike'
class Acronym(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
c = models.CharField(max_length=50, blank=True, null=True)
a = models.CharField(max_length=50, blank=True, null=True)
m = models.CharField(max_length=50, blank=True, null=True)
p = models.CharField(max_length=50, blank=True, null=True)
class Meta:
# managed = False
db_table = 'acronym'
class Audios(models.Model):
filename = models.CharField(max_length=255)
title = models.CharField(max_length=255, blank=True, null=True)
description = models.TextField(blank=True, null=True)
class Meta:
# managed = False
db_table = 'audios'
class Comments(models.Model): #not used
comment = models.TextField()
name = models.CharField(max_length=150, blank=True, null=True)
email = models.CharField(max_length=255, blank=True, null=True)
personid = models.IntegerField(db_column='personID', blank=True, null=True) # Field name made lowercase.
dateadded = models.DateTimeField(db_column='dateAdded') # Field name made lowercase.
datemodified = models.DateTimeField(db_column='dateModified', blank=True, null=True) # Field name made lowercase.
parentid = models.IntegerField(db_column='parentID', blank=True, null=True) # Field name made lowercase.
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
ip = models.CharField(db_column='IP', max_length=50, blank=True, null=True) # Field name made lowercase.
class Meta:
# managed = False
db_table = 'comments'
class Content(models.Model): class Content(models.Model):
published = models.BooleanField(default=False)
view = models.ForeignKey("Views", null=True, blank=True, db_column="view")
parent = models.ForeignKey('Content', null=True, blank=True, related_name='children', db_index=True, db_column='parentId')
type = models.ForeignKey("ContentTypes", db_column="type") type = models.ForeignKey("ContentTypes", db_column="type")
shortname = models.CharField(db_column='shortName', max_length=255) shortname = models.CharField(db_column='shortName', max_length=255) # Field name made lowercase.
title = models.CharField(max_length=255) title = models.CharField(max_length=255)
header = models.TextField(blank=True, null=True) header = MarkdownxField(blank=True, null=True, default='')
body = models.TextField(blank=True, null=True) body = MarkdownxField(blank=True, null=True, default='')
teaser = models.TextField(blank=True, null=True, validators=[MaxLengthValidator(200)])
schedule = models.TextField(blank=True, null=True) schedule = models.TextField(blank=True, null=True)
schedulebutton = models.CharField(db_column='scheduleButton', max_length=255, blank=True, null=True) schedulebutton = models.CharField(db_column='scheduleButton', max_length=255, blank=True, null=True) # Field name made lowercase.
optbtn2 = models.CharField(db_column='optBtn2', max_length=127, blank=True, null=True) optbtn2 = models.CharField(db_column='optBtn2', max_length=127, blank=True, null=True) # Field name made lowercase.
opttext2 = models.TextField(db_column='optText2', blank=True, null=True) opttext2 = models.TextField(db_column='optText2', blank=True, null=True) # Field name made lowercase.
optbtn3 = models.CharField(db_column='optBtn3', max_length=127, blank=True, null=True) optbtn3 = models.CharField(db_column='optBtn3', max_length=127, blank=True, null=True) # Field name made lowercase.
opttext3 = models.TextField(db_column='optText3', blank=True, null=True) opttext3 = models.TextField(db_column='optText3', blank=True, null=True) # Field name made lowercase.
technotes = models.TextField(db_column='technotes', blank=True, null=True) technotes = models.TextField(db_column='technotes', blank=True, null=True)
image = models.CharField(max_length=150, blank=True, null=True) image = models.CharField(max_length=150, blank=True, null=True)
postedby = models.CharField(db_column='postedBy', max_length=50, blank=True, null=True) postedby = models.CharField(db_column='postedBy', max_length=50, blank=True, null=True) # Field name made lowercase.
datestart = models.DateField(db_column='dateStart', blank=True, null=True) datestart = models.DateField(db_column='dateStart', blank=True, null=True) # Field name made lowercase.
dateend = models.DateField(db_column='dateEnd', blank=True, null=True) dateend = models.DateField(db_column='dateEnd', blank=True, null=True) # Field name made lowercase.
dateadded = models.DateTimeField(db_column='dateAdded', auto_now_add=True, null=True) dateadded = models.DateTimeField(db_column='dateAdded', auto_now_add=True, editable=True) # Field name made lowercase.
datemodified = models.DateTimeField(db_column='dateModified', blank=True, null=True, auto_now=True) datemodified = models.DateTimeField(db_column='dateModified', blank=True, null=True, auto_now=True) # Field name made lowercase.
published = models.BooleanField(default=False)
featured = models.BooleanField(default=False)
view = models.ForeignKey("Views", null=True, blank=True, db_column="view", editable=False)
place = models.CharField(max_length=255, null=True, blank=True) place = models.CharField(max_length=255, null=True, blank=True)
parents = models.ManyToManyField('Content', through='ContentContent', related_name="children")
resources = models.ManyToManyField('Resources', through='ContentResource', related_name="content") resources = models.ManyToManyField('Resources', through='ContentResource', related_name="content")
def __unicode__(self): # delete after migration
return self.title or 'Untitled' parentid = models.IntegerField(null=True, db_column='parentID', blank=True, editable=False)
class Meta: # end of delte
db_table = 'content'
def __unicode__(self):
return self.title
@property
def formatted_header(self):
return mark_safe(markdownify(self.header))
@property
def formatted_body(self):
return mark_safe(markdownify(self.body))
@property
def formatted_teaser(self):
if self.teaser:
value = self.teaser
elif self.header:
value = ox.strip_tags(ox.decode_html(markdownify(self.header)))[:100]
else:
value = ''
return mark_safe(value)
@property
def typefilter(self):
return self.type
@property @property
def image_url(self): def image_url(self):
if self.image: if self.image:
return settings.IMAGE_PREFIX + self.image return settings.IMAGE_PREFIX + self.image
def get_absolute_url(self):
if self.shortname:
return reverse('content', kwargs={'shortname': self.shortname})
def links(self): def links(self):
return self.resources.filter(type=3).order_by('orderno') return self.resources.filter(type=3).order_by('orderno')
def images(self): def images(self):
return self.resources.filter(type=2).exclude(href=self.image).order_by('orderno') return self.resources.filter(type=2).exclude(href=self.image).order_by('orderno')
def get_absolute_url(self):
if self.shortname:
parts = []
section = self.type.name
if section == 'news':
section = 'events'
if section == 'page':
parts = [self.shortname]
else:
parts = [section, self.shortname]
return '/' + '/'.join(parts)
def get_gallery(self):
gallery, created = Gallery.objects.get_or_create(slug=self.shortname)
if created:
title = self.title
n = 1
while Gallery.objects.filter(title=title).exclude(pk=gallery.pk).exists():
n += 1
title = '%s [%s]' % (self.title, n)
gallery.title = title
gallery.save()
return gallery
class Meta:
managed = True
db_table = 'content'
class ContentContent(models.Model):
contentid1 = models.ForeignKey("content", db_column='contentID1', related_name="child") # Field name made lowercase.
contentid2 = models.ForeignKey("content", db_column='contentID2', related_name="parent") # Field name made lowercase.
def __unicode__(self):
return self.contentid1.title
class Meta:
# managed = False
db_table = 'content_content'
def reverse(self):
r, created = ContentContent.objects.get_or_create(contentid1=self.contentid2, contentid2=self.contentid1)
return r
def save(self, *args, **kwargs):
super(ContentContent, self).save(*args, **kwargs)
self.reverse()
class ContentKeyword(models.Model):
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
keywordid = models.IntegerField(db_column='keywordID') # Field name made lowercase.
class Meta:
# managed = False
db_table = 'content_keyword'
class ContentResource(models.Model):
contentid = models.ForeignKey('Content', db_column='contentID')
resourceid = models.ForeignKey('Resources', db_column='resourceID')
def __unicode__(self):
return self.resource.href
class Meta:
# managed = False
db_table = 'content_resource'
class ContentTypes(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
def __unicode__(self):
return self.name
class Meta:
# managed = False
db_table = 'content_types'
class Keywords(models.Model):
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
class Meta:
# managed = False
db_table = 'keywords'
class People(models.Model): #not used
name = models.CharField(max_length=255, blank=True, null=True)
email = models.CharField(max_length=255, blank=True, null=True)
location = models.CharField(max_length=255, blank=True, null=True)
login = models.CharField(max_length=100, blank=True, null=True)
password = models.CharField(max_length=16, blank=True, null=True)
href = models.CharField(max_length=255, blank=True, null=True)
bio = models.TextField(blank=True, null=True)
type = models.IntegerField()
resources = models.ManyToManyField('Resources', through='PersonResource', related_name='people')
content = models.ManyToManyField('Content', through='PersonContent', related_name='people')
def __unicode__(self):
return self.name
class Meta:
# managed = False
db_table = 'people'
class PersonContent(models.Model):
personid = models.ForeignKey("people", db_column="personID")
contentid = models.ForeignKey("content", db_column="contentID")
level = models.IntegerField()
class Meta:
# managed = False
db_table = 'person_content'
class PersonResource(models.Model):
personid = models.ForeignKey("people", db_column="personID")
resourceid = models.ForeignKey("resources", db_column="resourceID")
class Meta:
# managed = False
db_table = 'person_resource'
class Resources(models.Model): class Resources(models.Model):
TYPE_CHOICES = ( TYPE_CHOICES = (
@ -69,12 +274,9 @@ class Resources(models.Model):
mime = models.CharField(max_length=10, blank=True, null=True) mime = models.CharField(max_length=10, blank=True, null=True)
width = models.IntegerField(blank=True, null=True) width = models.IntegerField(blank=True, null=True)
height = models.IntegerField(blank=True, null=True) height = models.IntegerField(blank=True, null=True)
istech = models.BooleanField(db_column='isTech') istech = models.IntegerField(db_column='isTech') # Field name made lowercase.
dateadded = models.DateTimeField(db_column='dateAdded', auto_now_add=True, null=True) dateadded = models.DateTimeField(db_column='dateAdded', null=True, blank=True) # Field name made lowercase.
orderno = models.IntegerField(db_column='orderNo', blank=True, null=True) orderno = models.IntegerField(db_column='orderNo', blank=True, null=True) # Field name made lowercase.
def __unicode__(self):
return self.href
def get_absolute_url(self): def get_absolute_url(self):
href = self.href href = self.href
@ -100,42 +302,45 @@ class Resources(models.Model):
return self.mime.lower() in ('ogv', 'mp4') return self.mime.lower() in ('ogv', 'mp4')
class Meta: class Meta:
# managed = False
db_table = 'resources' db_table = 'resources'
''' class File(models.Model):
class ContentContent(models.Model): content = models.ForeignKey('Content')
contentid1 = models.ForeignKey('Content', db_column='contentID1', related_name='child') fil = models.FileField(upload_to='files')
contentid2 = models.ForeignKey('Content', db_column='contentID2', related_name='parent')
def __unicode__(self):
return "%s is child of %s" % (self.contentid1.title, self.contentid2.title,)
class Meta:
managed = False
db_table = 'content_content'
'''
class ContentResource(models.Model):
content = models.ForeignKey('Content', db_column='contentID')
resource = models.ForeignKey('Resources', db_column='resourceID')
def __unicode__(self):
return self.resource.href
class Meta:
db_table = 'content_resource'
class ContentTypes(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True) description = models.TextField(blank=True, null=True)
date = models.DateTimeField(auto_now_add=True)
order = models.IntegerField(blank=True, null=True)
def __unicode__(self): class Image(models.Model):
return self.name content = models.ForeignKey('Content', related_name='images')
image = models.ImageField(upload_to='camp/static/images')
description = models.TextField(blank=True, null=True)
date = models.DateTimeField(auto_now_add=True)
order = models.IntegerField(blank=True, null=True)
class Link(models.Model):
content = models.ForeignKey('Content')
url = models.URLField()
description = models.TextField(blank=True, null=True)
date = models.DateTimeField(auto_now_add=True)
order = models.IntegerField(blank=True, null=True)
class Videos(models.Model): # not used
sha1 = models.CharField(max_length=50)
href = models.CharField(max_length=255)
title = models.TextField(blank=True, null=True)
description = models.TextField(blank=True, null=True)
width = models.IntegerField(blank=True, null=True)
height = models.IntegerField(blank=True, null=True)
duration = models.IntegerField(blank=True, null=True)
thumbno = models.IntegerField(db_column='thumbNo') # Field name made lowercase.
image = models.CharField(max_length=255, blank=True, null=True)
contentid = models.IntegerField(blank=True, null=True)
class Meta: class Meta:
db_table = 'content_types' # managed = False
db_table = 'videos'
class Views(models.Model): class Views(models.Model):
@ -146,122 +351,12 @@ class Views(models.Model):
return self.name return self.name
class Meta: class Meta:
# managed = False
db_table = 'views' db_table = 'views'
# unused but has values in db
class Acrolike(models.Model): class MyModel(models.Model):
title = models.CharField(max_length=255) myfield = MarkdownxField()
class Meta:
db_table = 'acrolike'
class Acronym(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
c = models.CharField(max_length=50, blank=True, null=True)
a = models.CharField(max_length=50, blank=True, null=True)
m = models.CharField(max_length=50, blank=True, null=True)
p = models.CharField(max_length=50, blank=True, null=True)
class Meta:
db_table = 'acronym'
class People(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
email = models.CharField(max_length=255, blank=True, null=True)
location = models.CharField(max_length=255, blank=True, null=True)
login = models.CharField(max_length=100, blank=True, null=True)
password = models.CharField(max_length=16, blank=True, null=True)
href = models.CharField(max_length=255, blank=True, null=True)
bio = models.TextField(blank=True, null=True)
type = models.IntegerField()
resources = models.ManyToManyField('Resources', through='PersonResource', related_name='people')
content = models.ManyToManyField('Content', through='PersonContent', related_name='people')
def __unicode__(self):
return self.name
class Meta:
db_table = 'people'
class PersonContent(models.Model):
personid = models.ForeignKey("people", db_column="personID")
contentid = models.ForeignKey("content", db_column="contentID")
level = models.IntegerField()
class Meta:
db_table = 'person_content'
class PersonResource(models.Model):
personid = models.ForeignKey("people", db_column="personID")
resourceid = models.ForeignKey("resources", db_column="resourceID")
class Meta:
db_table = 'person_resource'
class Videos(models.Model):
sha1 = models.CharField(max_length=50)
href = models.CharField(max_length=255)
title = models.TextField(blank=True, null=True)
description = models.TextField(blank=True, null=True)
width = models.IntegerField(blank=True, null=True)
height = models.IntegerField(blank=True, null=True)
duration = models.IntegerField(blank=True, null=True)
thumbno = models.IntegerField(db_column='thumbNo')
image = models.CharField(max_length=255, blank=True, null=True)
contentid = models.IntegerField(blank=True, null=True)
class Meta:
db_table = 'videos'
def image_url(self):
return settings.IMAGE_PREFIX + self.image
# UNUSED
class Audios(models.Model):
filename = models.CharField(max_length=255)
title = models.CharField(max_length=255, blank=True, null=True)
description = models.TextField(blank=True, null=True)
class Meta:
db_table = 'audios'
class Comments(models.Model):
comment = models.TextField()
name = models.CharField(max_length=150, blank=True, null=True)
email = models.CharField(max_length=255, blank=True, null=True)
personid = models.IntegerField(db_column='personID', blank=True, null=True)
dateadded = models.DateTimeField(db_column='dateAdded', auto_now_add=True, null=True)
datemodified = models.DateTimeField(db_column='dateModified', blank=True, null=True, auto_now=True)
parentid = models.IntegerField(db_column='parentID', blank=True, null=True)
parent = models.ForeignKey('Comments', null=True, blank=True, related_name='comments', db_index=True, db_column='parentId')
content = models.ForeignKey('Content', null=True, blank=True, related_name='comments', db_index=True, db_column='contentID')
ip = models.CharField(db_column='IP', max_length=50, blank=True, null=True)
class Meta:
db_table = 'comments'
class Keywords(models.Model):
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
class Meta:
db_table = 'keywords'
class ContentKeyword(models.Model):
content = models.ForeignKey('Content', db_column='contentID')
keyword = models.ForeignKey('Keywords', db_column='keywordID')
class Meta:
db_table = 'content_keyword'

View File

@ -1,92 +0,0 @@
body {
background-color: #ffffff !important;
font-size: 14px !important;
}
.content_detail {
width: 70%;
padding-left: 5%;
}
.right-items {
padding-bottom: 0.5em;
padding-top: 0.5em;
}
body, h1, h2, h3, h4, h5, h6 {
font-family: Open Sans !important;
}
.sidebar-h4 {
font-weight: 600;
text-transform: uppercase;
font-size: 1em;
}
.sidebar-title {
text-transform: capitalize;
font-weight: 800;
font-style: italic;
font-size: 1em;
color: #000000;
}
.sidebar-date {
text-transform: uppercase;
font-size: 0.7em;
font-weight: bold;
color: #ef4e5c;
}
.special-column {
padding-left: 0em !important;
}
.index-text {
padding-left: 3%;
padding-right: 1%;
padding-top: 10px;
}
.index-text p {
text-align: justify;
}
.title-bar-right {
margin-right: 2em;
margin-top: 1em;
}
.menu-icon::after{
background: #111111 none repeat scroll 0 0 !important;
box-shadow: 0 7px 0 #111111, 0 14px 0 #111111 !important;
}
.vertical-menu li {
list-style: none;
padding-top: 2em;
padding-left: 1em;
font-weight: 600;
font-size: 1em;
color: #ef4e5c;
background-color: #eeeeee;
}
.off-canvas {
background-color: #eeeeee !important;
}
.position-right.is-transition-push::after {
box-shadow: none !important;
}
.admin-menu {
position: absolute;
top: 45px;
right: 25px;
}
.context ul, .links ul {
list-style: none;
}

View File

@ -10,6 +10,7 @@
<link rel="stylesheet" type="text/css" href="{% static "css/main.css" %}"> <link rel="stylesheet" type="text/css" href="{% static "css/main.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "css/app.css" %}"> <link rel="stylesheet" type="text/css" href="{% static "css/app.css" %}">
<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" %}">
</head> </head>
<body> <body>
@ -18,13 +19,13 @@
<div class="off-canvas position-right" id="offCanvasRight" data-off-canvas data-position="right"> <div class="off-canvas position-right" id="offCanvasRight" data-off-canvas data-position="right">
<ul class="vertical-menu"> <ul class="vertical-menu">
<li><a href="{% url 'index' %}">HOME</a></li> <li><a href="/">HOME</a></li>
<li><a href="{% url 'about' %}">ABOUT</a></li> <li><a href="/about">ABOUT</a></li>
<li><a href="{% url 'projects' %}">PROJECTS</a></li> <li><a href="/projects">PROJECTS</a></li>
<li><a href="{% url 'events' %}">EVENTS</a></li> <li><a href="/events">EVENTS</a></li>
<li><a href="{% url 'works' %}">WORKS</a></li> <li><a href="/works">WORKS</a></li>
<li><a href="{% url 'texts' %}">TEXTS</a></li> <li><a href="/texts">TEXTS</a></li>
<li><a href="{% url 'contact' %}">CONTACT</a></li> <li><a href="/contact">CONTACT</a></li>
</ul> </ul>
</div> </div>
@ -40,11 +41,34 @@
{% endblock %} {% endblock %}
{% load static %} {% load static %}
<script src="{% static "js/jquery.js" %}"></script> <script src="{% static "js/jquery.js" %}"></script>
<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" %}"></script>
<script type="text/javascript">
$(document).ready(function(){
var slider = $('.slider1').bxSlider({
adaptiveHeight : true,
pager : false,
});
$(document).keydown(function(e){
if (e.keyCode == 39) // Right arrow
{
slider.goToNextSlide();
return false;
}
else if (e.keyCode == 37) // left arrow
{
slider.goToPrevSlide();
return false;
}
});
});
</script>
</body> </body>
</html> </html>

View File

@ -1,157 +0,0 @@
{% extends 'base.html' %}
{% block content %}
{% if request.user.is_staff %}
<div class="admin-menu">
<a href="{% url 'admin:content_content_change' content.id %}">Edit</a>
</div>
{% endif %}
{% if content.image_url %}
<img src="{{ content.image_url }}" width="75%">
{% endif %}
<div class="content_detail">
<h1>{{ content.title }}</h1>
<h4>{{ content.header|safe }} </h4>
<p>{{ content.body|safe }}</p>
{% if content.optbtn2 and content.opttext2 %}
<div class="part2">
<h4>{{ content.optbtn2|safe }} </h4>
<p>{{ content.opttext2|safe|linebreaks }}</p>
</div>
{% endif %}
{% if content.optbtn3 and content.opttext3 %}
<div class="part3">
<h4>{{ content.optbtn3|safe }} </h4>
<p>{{ content.opttext3|safe|linebreaks }}</p>
</div>
{% endif %}
{% if content.schedule %}
<div class="schedule">
<h4>{{content.schedulebutton|default:"Schedule"}}</h4>
<p>{{ content.schedule|safe|linebreaks }}</p>
</div>
{% endif %}
{% if content.parent or content.children.exists %}
<div class="context">
<b>In This Event</b>:
<ul>
{% if content.parent and content.parent.title %}
<li><a href="{{content.parent.get_absolute_url}}">{{content.parent.title}}</a></li>
<li><ul>
{% for node in content.parent.children.all %}
{% if node.shortname and node.published %}
<li>
{% if node == content %}
{{node.title}}
{% else %}
<a href="{{node.get_absolute_url}}">{{ node.title }}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul><li>
{% elif content.children.exists %}
<li>{{content.title}}</li>
<li><ul>
{% for node in content.children.all %}
{% if node.shortname and node.published %}
<li>
<a href="{{node.get_absolute_url}}">{{ node.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul><li>
{% else %}
<li>{{content.title}}</li>
{% endif %}
</ul>
</div>
{% endif %}
{% if content.resources.exists %}
{% if content.links.exists %}
<div class="links">
<b>Links:</b>
<ul>
{% for res in content.links %}
<li>
<a href="{{res.get_absolute_url}}">{{res.description|default:res.href}}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if content.images.exists %}
<style>
.images {
display: grid;
grid-template-columns: 128px 128px 128px 128px 128px 128px 128px 128px;
grid-gap: 10px;
}
.images > div {
width: 128px;
height: 128px;
padding: 8px;
display: table-cell;
text-align: center;
position: relative;
}
.images > div > img {
transition: width,height 2s;
max-width: 92%;
max-height: 92%;
position: absolute;
top:0;
bottom:0;
left:0;
right:0;
margin:auto;
}
.images > div > img.active {
max-width: 92%;
max-height: 92%;
position: fixed;
top:0;
bottom:0;
left:0;
right:0;
margin:auto;
z-index: 1;
}
</style>
<b>Images:</b> <br>
<div class="images">
{% for res in content.images %}
<div>
{% if res.is_image %}
<img src="{{res.get_absolute_url}}">
{% elif res.is_audio %}
<audio controls src="{{res.get_absolute_url}}"></audio>
{% elif res.is_video %}
<video controls src="{{res.get_absolute_url}}"></video>
{% else %}
<a href="{{res.get_absolute_url}}">{{res.description|default:res.href}}</a>
{% endif %}
</div>
{% endfor %}
</div>
<script>
document.querySelectorAll('.images > div > img').forEach(function(img) {
img.addEventListener('click', function() {
if (this.classList.contains('active')) {
this.classList.remove('active');
} else {
this.classList.add('active');
}
});
});
</script>
{% endif %}
{% endif %}
</div>
{% endblock %}

View File

@ -0,0 +1,21 @@
{% extends 'base.html' %}
{% block content %}
{% include "featured.html" %}
<div class="large-4 medium-4 columns">
{% if upcoming_events.exists %}
<h4 class="sidebar-h4"> Upcoming Events </h4>
{% include "event_preview.html" with events=upcoming_events %}
{% endif %}
{% if ongoing_events.exists %}
<h4 class="sidebar-h4"> Ongoing Events </h4>
{% include "event_preview.html" with events=ongoing_events %}
{% endif %}
{% if past_events.exists %}
<h4 class="sidebar-h4"> Past Events </h4>
{% include "event_preview.html" with events=past_events %}
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,38 @@
<div class="row">
{% for content in events %}
{% if content.type.name == 'news' %}
<div class="row right-items">
<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>
</div>
{% elif content.type.name == 'events' %}
<div class="row right-items">
{% if content.image_url %}
<div class="small-6 columns">
<a href="{{ content.get_absolute_url }}">
<img src="{{ content.image_url }}">
</a>
</div>
{% endif %}
<div class="small-6 columns">
<a href="{{ content.get_absolute_url }}" class="sidebar-title">{{ content.title }}</a>
<h6 class="sidebar-date">
<font color="#ef4e5c">
<b>{{ content.datestart }} {% if content.dateend %} - {{content.dateend}} {% endif %}</b>
</font>
{%if content.place %}<br>{{content.place}}{% endif %}
</h6>
<p> {{content.formatted_teaser}} </p>
</div>
</div>
{% endif %}
{% endfor %}
<br>
<br>
</div>

View File

@ -0,0 +1,52 @@
{% extends 'base.html' %}
{% block content %}
<div class="large-8 medium-8 columns special-column">
{% if events.image %}
<img src="{{events.image_url}}">
{% endif %}
<div class="index-text">
<h4><a href="{{ events.get_absolute_url }}/" class="big-title">{{events.title}} </a></h4>
<p> {{events.formatted_header|safe}} </p>
<p> {{events.formatted_body|safe}} </p>
{% include "opt.html" with content=events %}
{% include "links.html" with content=events %}
{% 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>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,21 @@
{% for content in featured %}
<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>
{% if content.datestart %}
<h6 class="big-date"> <font color="#ef4e5c"> <b> {{ content.datestart }} </b></font>
{% if content.place %}<br/>{{content.place}}{% endif%}
</h6>
{% endif %}
{% if content.header %}
<p> {{content.formatted_header}} </p>
{% else %}
<p> {{content.formatted_body}} </p>
{% endif %}
<a href="{{ content.get_absolute_url }}">read more</a> </p>
</div>
</div>
{% endfor %}

View File

@ -0,0 +1,8 @@
{% if gallery %}
<h6><strong>Gallery: {{gallery.title}}</strong></h6>
<ul class="clearing-thumbs" data-clearing>
{% for photo in gallery.public %}
<li><a href="{{ photo.get_absolute_url }}"><img src="{{ photo.get_thumbnail_url }}"></a></li>
{% endfor %}
</ul>
{% endif %}

View File

@ -3,41 +3,29 @@
{% block content %} {% block content %}
{% if latest_content_list %} {% for content in homepage %}
{% for content in latest_content_list %}
{% if forloop.counter == 3 %}
<div class="large-8 medium-8 columns special-column"> <div class="large-8 medium-8 columns special-column">
<img src="{{ content.image_url }}">
<div class="index-text"> <div class="index-text">
<h4><a href="{{ content.get_absolute_url }}">{{content.title}}</a></h4> <h4 class="big-title">{{content.title}} </a></h4>
<p> <p> {{content.formatted_header}} </p>
{{content.body|striptags|truncatechars:250}} <a href="{{ content.get_absolute_url }}">read more</a> <p> {{content.formatted_body}} </p>
</p>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
</div> </div>
<div class="large-4 medium-4 columns"> <div class="large-4 medium-4 columns">
{% if upcoming_events.exists %}
<h4 class="sidebar-h4"> Upcoming Events </h4> <h4 class="sidebar-h4"> Upcoming Events </h4>
<div class="row"> {% include "event_preview.html" with events=upcoming_events %}
{% endif %}
{% for content in latest_content_list %} {% if ongoing_events.exists %}
<div class="row right-items"> <h4 class="sidebar-h4"> Ongoing Events </h4>
<div class="small-6 columns"> {% include "event_preview.html" with events=ongoing_events %}
<img src="{{ content.image_url }}"> {% endif %}
</div> {% if past_events.exists %}
<div class="small-6 columns"> <h4 class="sidebar-h4"> Past Events </h4>
<a href="{{ content.get_absolute_url }}" class="sidebar-title">{{ content.title }}</a> {% include "event_preview.html" with events=past_events %}
<h6 class="sidebar-date">{{ content.datestart }}</h6> {% endif %}
{{ conntent.header }} </div>
</div>
</div>
{% endfor %}
{% else %}
<p>No polls are available.</p>
{% endif %}
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,12 @@
{% if content.links.exists %}
<div class="links">
<b>Links:</b>
<ul>
{% for res in content.links %}
<li>
<a href="{{res.get_absolute_url}}">{{res.description|default:res.href}}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}

View File

@ -0,0 +1,18 @@
{% if content.optbtn2 and content.opttext2 %}
<div class="part2">
<h4>{{ content.optbtn2|safe }} </h4>
<p>{{ content.opttext2|safe|linebreaks }}</p>
</div>
{% endif %}
{% if content.optbtn3 and content.opttext3 %}
<div class="part3">
<h4>{{ content.optbtn3|safe }} </h4>
<p>{{ content.opttext3|safe|linebreaks }}</p>
</div>
{% endif %}
{% if content.schedule %}
<div class="schedule">
<h4>{{content.schedulebutton|default:"Schedule"}}</h4>
<p>{{ content.schedule|safe|linebreaks }}</p>
</div>
{% endif %}

View File

@ -0,0 +1,17 @@
{% extends 'base.html' %}
{% block content %}
<div class="large-8 medium-8 columns special-column">
<div class="index-text">
<h4>{{content.title}}</h4>
{% if content.header %}
<p>
{{content.formatted_header|safe}}
</p>
{% endif %}
<p>
{{content.formatted_body|safe}}
</p>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends "photologue:photologue/gallery_detail.html" %}
{% load i18n %}
{% block title %}{{ gallery.title }}{% endblock %}
{% block content %}
<div class="row col-lg-12">
<h1 class="page-header">{{ gallery.title }}</h1>
<p class="muted"><small>{% trans "Published" %} {{ gallery.date_added }}</small>WHYYYYYY</p>
{% if gallery.description %}{{ gallery.description|safe }}{% endif %}
{% for photo in gallery.public %}
<a href="{{ photo.get_absolute_url }}">
<img src="{{ photo.get_thumbnail_url }}" class="thumbnail" alt="{{ photo.title }}">
</a>
{% endfor %}
<div><a href="{% url 'photologue:gallery-list' %}" class="btn btn-default">{% trans "View all galleries" %}</a></div>
</div>
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends "photologue:photologue/photo_detail.html" %}
{% load photologue_tags i18n %}
{% block title %}{{ object.title }}{% endblock %}
{% block content %}
{% for gallery in object.public_galleries %}
<div class="row">
<div class="medium-9 columns">
<h5 class="page-header">From gallery {{ gallery.title }}</h5>
<ul class="slider1">
{% for photo.pk in gallery.public %}
<li>
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
<br /> <p>{{ photo.caption|safe }} <a href="{{ photo.image.url }}"> Link to original file </a> </p>
</li>
{% for photo in gallery.public %}
<li>
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
<br /> <p>{{ photo.caption|safe }} <a href="{{ photo.image.url }}" target="_blank" > Link to original file </a> </p>
</li>
{% endfor %}
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
{% 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 %}

View File

@ -0,0 +1,21 @@
<div class="row">
<div class="row right-items">
<div class="small-6 columns">
{% if content.image_url %}
<img src="{{ content.image_url }}">
{% endif %}
</div>
<div class="small-6 columns">
<a href="{{ content.get_absolute_url }}" class="sidebar-title"> {{content.title}} </a>
{% if content.type.name == 'events' %}
<h6 class="sidebar-date">
<font color="#ef4e5c">
<b> {{ content.datestart }} {% if content.dateend %} - {{content.dateend}} {% endif %} </b>
</font>
{% if content.place %}<br/>{{content.place}}{% endif%}
</h6>
{% endif %}
<p> {{ content.formatted_teaser }} </p>
</div>
</div>
</div>

View File

@ -1,22 +1,45 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block content %}
<div class="large-4 medium-4 columns">
<h4 class="sidebar-h4">{{ title }}</h4>
<div class="row">
{% for content in content %}
<div class="row right-items">
<div class="small-6 columns">
<img src="{{ content.image_url }}">
</div>
<div class="small-6 columns">
<a href="{{ content.get_absolute_url }}" class="sidebar-title">{{ content.title }}</a>
<h6 class="sidebar-date">{{ content.datestart }}</h6>
{{content.header|striptags|truncatechars:150|safe}} <a href="{{ content.get_absolute_url }}">read more</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %} <div class="large-8 medium-8 columns special-column">
{% if projects.image %}
<img src="{{ projects.image_url }}">
{% endif %}
<div class="index-text">
<h4><a href="{{ projects.get_absolute_url }}/" class="big-title">{{projects.title}} </a></h4>
<p> {{projects.formatted_header|safe}} </p>
<p> {{projects.formatted_body|safe}} </p>
{% include "opt.html" with content=projects %}
{% include "links.html" with content=projects %}
{% 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>
{% endfor %}
{% else %}
<p>No projects.</p>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,8 @@
{% if related %}
<h4 class="sidebar-h4"> Related </h4>
{% for content in related %}
{% include "preview.html" %}
{% endfor %}
<br>
<br>
{% endif %}

View File

@ -0,0 +1,71 @@
{% extends 'base.html' %}
{% block content %}
<div class="row">
<div class="row">
<div class="small-4 small-offset-2 columns results-title">
<h3> Search results </h3>
</div>
</div>
{% for content in results %}
{% if content.type.name == 'news' %}
<div class="row">
<div class= "small-4 small-offset-2 columns">
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{content.datestart}} </b>
{{ content.title }} <br />
{{ content.formatted_header|striptags|safe }} </font>
</h6>
</div>
</div>
{% elif content.type.name == 'events' %}
<div class="row results">
<div class="small-4 small-offset-2 columns">
<img src="{{ content.image_url }}">
</div>
<div class="small-4 end columns">
<a href="{{ content.get_absolute_url }}" class="sidebar-title">{{ content.title }}</a>
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{ content.datestart }} {% if content.dateend %} - {{content.dateend}} {% endif %} </b></font>
{% if content.place %}<br/> {{content.place}} {% endif%}</h6>
<p> {{content.header|striptags|safe}} </p>
<a href="{{ content.get_absolute_url }}">read more</a> </p>
</div>
</div>
{% else %}
<div class="row">
<div class="small-4 small-offset-2 columns">
Add view for content type: {{content.type}}
</div>
</div>
{% endif %}
{% endfor %}
<br>
<br>
{% if results.has_other_pages %}
<div class="row">
<div class="small-4 small-offset-4 columns">
<ul class="pagination">
{% if results.has_previous %}
<li><a href="?q={{ query }}&page={{ results.previous_page_number }}">&laquo;</a></li>
{% else %}
<li class="disabled"><span>&laquo;</span></li>
{% endif %}
{% for i in results.paginator.page_range %}
{% if results.number == i %}
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li><a href="?q={{ query }}&page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if results.has_next %}
<li><a href="?q={{ query }}&page={{ results.next_page_number }}">&raquo;</a></li>
{% else %}
<li class="disabled"><span>&raquo;</span></li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -0,0 +1,25 @@
{% extends 'base.html' %}
{% block content %}
{% include "featured.html" %}
<div class="large-4 medium-4 columns">
<h4 class="sidebar-h4"> {{ section }} </h4>
<div class="row">
{% for content in content %}
<div class="row right-items">
{% if content.image_url %}
<div class="small-6 columns">
<img src="{{ content.image_url }}">
</div>
{% endif %}
<div class="small-6 columns">
<a href="{{ content.get_absolute_url }}/" class="sidebar-title">{{ content.title }}</a>
<p> {{content.formatted_teaser}} </p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,57 @@
{% extends 'base.html' %}
{% block content %}
<div class="large-8 medium-8 columns special-column">
{% if texts.image %}
<img src="{{ texts.image_url }}">
{% endif %}
<div class="index-text">
<h4><a href="{{ texts.get_absolute_url }}/" class="big-title">{{texts.title}} </a></h4>
<p> {{texts.formatted_header|safe}} </p>
<p> {{texts.formatted_body|safe}} </p>
{% 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>
{% endfor %}
{% 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 %}

View File

@ -0,0 +1,52 @@
{% extends 'base.html' %}
{% block content %}
<div class="large-8 medium-8 columns special-column">
<img src="{{ works.image_url }}">
<div class="index-text">
<h4><a href="{{ works.get_absolute_url }}" class="big-title">{{works.title}} </a></h4>
<p> {{works.formatted_header|safe}} </p>
<p> {{works.formatted_body|safe}} </p>
</div>
</div>
{% 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>
{% endfor %}
{% 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 %}

View File

@ -1,66 +1,156 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.http import HttpResponse from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
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
from django.views.generic.list import ListView
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from .models import Content from photologue.views import GalleryListView
from photologue.models import Photo, Gallery
from .models import Content, ContentContent
# Create your views here.
def index(request): def index(request):
content = Content.objects.all() now = datetime.now()
content = content.filter(published=True) display_events = ['news', 'events']
latest_content_list = content.order_by('-datestart')[:5] base = Content.objects.filter(type__name__in=display_events).order_by('-datestart')
context = {'latest_content_list': latest_content_list} base = base.filter(published=True)
upcoming_events = base.filter(datestart__gt=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]
context = {
'upcoming_events': upcoming_events,
'ongoing_events': ongoing_events,
'past_events': past_events,
'homepage': homepage}
return render(request, 'index.html', context) return render(request, 'index.html', context)
def content(request, shortname):
if request.user.is_staff:
content = get_object_or_404(Content, shortname=shortname)
else:
content = get_object_or_404(Content, shortname=shortname, published=True)
return render(request, 'detail.html', {'content': content})
def projects(request): def section_index(request, types, section):
content = Content.objects.filter(type__name='ongoing').exclude(shortname='').order_by('-datestart') featured = Content.objects.filter(type__name__in=types, featured=True).order_by('-datestart')[:1]
content = Content.objects.filter(type__name__in=types).order_by('-datestart')
if featured:
content = content.exclude(pk=featured[0].pk)
content = content.filter(published=True) content = content.filter(published=True)
return render(request, 'projects.html', { return render(request, 'section_index.html', {
'content': content, 'section': section,
'title': 'Projects' 'featured': featured,
'content': content
}) })
def events(request): def event(request):
content = Content.objects.filter(type__name='events').exclude(shortname='') now = datetime.now()
content = Content.objects.filter(type__name='events').exclude(shortname='').order_by('-datestart') display_events = ['events']
content = content.filter(published=True) 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 = base.filter(published=True)
if featured:
base = base.exclude(pk=featured[0].pk)
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))[:10]
context = {
'upcoming_events': upcoming_events,
'ongoing_events': ongoing_events,
'past_events': past_events,
'featured': featured,
}
return render(request, 'event.html', context)
def events(request, shortname=None):
if not shortname:
return event(request)
events = get_object_or_404(Content, shortname=shortname, type__name__in=['news', 'events'])
if not events.published and not request.user.is_staff:
raise Http404
gallery = get_or_none(Gallery, slug=shortname)
latest_content_list = Content.objects.filter(type__name='events').order_by('-datestart')[:10]
return render(request, 'events.html', {'events': events, 'latest_content_list': latest_content_list, 'gallery': gallery})
def projects(request, shortname=None):
if not shortname:
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', { return render(request, 'projects.html', {
'content': content, 'projects': projects,
'title': 'Upcoming Events' 'latest_content_list': latest_content_list,
'gallery': gallery
}) })
def works(request): def works(request, shortname=None):
content = Content.objects.filter(type__name='works').exclude(shortname='').order_by('-datestart') if not shortname:
content = content.filter(published=True) return section_index(request, ['works'], 'Works')
return render(request, 'projects.html', { works = get_object_or_404(Content, shortname=shortname, type__name='works')
'content': content, if not works.published and not request.user.is_staff:
'title': 'Works' 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):
if not shortname:
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 texts(request):
content = Content.objects.filter(type__name='texts').exclude(shortname='') def page(request, shortname):
content = content.filter(published=True) content = get_object_or_404(Content, shortname=shortname, type__name='page')
return render(request, 'projects.html', { if not content.published and not request.user.is_staff:
'content': content, raise Http404
'title': 'Texts' return render(request, 'page.html', {'content': content})
def search(request):
q = request.GET.get('q')
results = Content.objects.filter(body__contains=q).order_by('-datestart')
page = request.GET.get('page', 1)
paginator = Paginator(results, 5)
try:
results = paginator.page(page)
except PageNotAnInteger:
results = paginator.page(1)
except EmptyPage:
results = paginator.page(paginator.num_pages)
return render(request, 'results.html', {
'results': results,
'query': q
}) })
def about(request):
content = get_object_or_404(Content, shortname='about')
return render(request, 'detail.html', {'content': content})
def contact(request): class GalleryListViews(ListView):
content = get_object_or_404(Content, shortname='contact') queryset = Gallery.objects.on_site().is_public()
return render(request, 'detail.html', {'content': content}) paginate_by = 20
template_name = 'gallery_list.html'
def get_or_none(classmodel, **kwargs):
try:
return classmodel.objects.get(**kwargs)
except classmodel.DoesNotExist:
return None
def redirect_index(request): def redirect_index(request):
@ -74,11 +164,12 @@ def redirect_index(request):
def redirect_event(request): def redirect_event(request):
shortname = request.GET.get('this') shortname = request.GET.get('this')
if shortname: if shortname:
return redirect(reverse('content', kwargs={'shortname': shortname})) content = get_object_or_404(Content, shortname=shortname)
return redirect(content.get_absolute_url())
id = request.GET.get('id') id = request.GET.get('id')
if id: if id:
content = get_object_or_404(Content, id=id) content = get_object_or_404(Content, id=id)
return redirect(reverse('content', kwargs={'shortname': content.shortname})) return redirect(content.get_absolute_url())
return redirect(reverse('events')) return redirect(reverse('events'))

View File

@ -0,0 +1,42 @@
<VirtualHost *:80>
ServerName studio.camp
Redirect / https://studio.camp/
</VirtualHost>
<VirtualHost *:443>
SSLCertificateFile /etc/letsencrypt/studio.camp/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/studio.camp/key.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/studio.camp/chain.pem
ServerName studio.camp
<Location />
Options -Indexes
</Location>
<Directory /srv/camp>
Order deny,allow
Allow from all
</Directory>
Alias /static /srv/camp/static
Alias /static/images /srv/camp/data/images
LogLevel warn
ErrorLog /var/log/apache2/studio.camp.error.log
CustomLog /var/log/apache2/studio.camp.log combined
ServerSignature Off
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /static !
ProxyPass /images !
RequestHeader unset Proxy
ProxyPass / http://127.0.0.1:8087/
ProxyPassReverse / http://127.0.0.1:8087/
</VirtualHost>

12
etc/init/camp.conf Normal file
View File

@ -0,0 +1,12 @@
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
# give time to send info to trackers
kill timeout 30
setuid campdjango
setgid campdjango
respawn
chdir /srv/camp
exec /srv/camp/venv/bin/gunicorn -b 127.0.0.1:8087 camp.wsgi:application

View File

@ -0,0 +1,14 @@
[Unit]
Description=studio.camp
After=postgresql.service
[Service]
Type=simple
Restart=always
User=campdjango
Group=campdjango
WorkingDirectory=/srv/camp
ExeccStart=/srv/camp/venv/bin/gunicorn -b 127.0.0.1:8087 camp.wsgi:application
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,8 @@
django<2.0 django<2.0
django_extensions django-markdownx
django-photologue
django-braces
django-app-namespace-template-loader
ox
gunicorn gunicorn
django_extensions