add sections, general cleanup
This commit is contained in:
parent
8c2c532ce7
commit
abdc173cc1
|
@ -37,6 +37,9 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
|
'django_extensions',
|
||||||
|
|
||||||
'content',
|
'content',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -121,7 +124,11 @@ USE_TZ = True
|
||||||
# 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/'
|
||||||
|
|
||||||
|
|
||||||
|
IMAGE_PREFIX = 'http://studio.camp/images/'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from local_settings import *
|
from local_settings import *
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
16
camp/urls.py
16
camp/urls.py
|
@ -20,7 +20,19 @@ from django.contrib import admin
|
||||||
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'),
|
||||||
url(r'^content/(?P<shortname>\w+)/$', views.content, name='content'),
|
|
||||||
url(r'^project/', views.project)
|
url(r'^.*index.php$', views.redirect_index, name='redirect_index'),
|
||||||
|
url(r'^.*event.php$', views.redirect_event, name='redirect_event'),
|
||||||
|
|
||||||
|
url(r'^projects/', views.projects, name='projects'),
|
||||||
|
url(r'^events/', views.events, name='events'),
|
||||||
|
url(r'^works/', views.works, name='works'),
|
||||||
|
url(r'^texts/', views.texts, name='texts'),
|
||||||
|
|
||||||
|
url(r'^about/', views.about, name='about'),
|
||||||
|
url(r'^contact/', views.contact, name='contact'),
|
||||||
|
|
||||||
|
|
||||||
|
url(r'^(?P<shortname>.+)/$', views.content, name='content'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
@ -84,6 +86,13 @@ class Content(models.Model):
|
||||||
managed = True
|
managed = True
|
||||||
db_table = 'content'
|
db_table = 'content'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def image_url(self):
|
||||||
|
if self.image:
|
||||||
|
return settings.IMAGE_PREFIX + self.image
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return reverse('content', kwargs={'shortname': self.shortname})
|
||||||
|
|
||||||
|
|
||||||
class ContentContent(models.Model):
|
class ContentContent(models.Model):
|
||||||
|
@ -204,6 +213,9 @@ class Videos(models.Model): # not used
|
||||||
managed = False
|
managed = False
|
||||||
db_table = 'videos'
|
db_table = 'videos'
|
||||||
|
|
||||||
|
def image_url(self):
|
||||||
|
return settings.IMAGE_PREFIX + self.image
|
||||||
|
|
||||||
|
|
||||||
class Views(models.Model):
|
class Views(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
|
|
|
@ -35,6 +35,8 @@ body, h1, h2, h3, h4, h5, h6 {
|
||||||
.sidebar-date {
|
.sidebar-date {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 0.7em;
|
font-size: 0.7em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ef4e5c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.special-column {
|
.special-column {
|
||||||
|
|
|
@ -18,13 +18,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>HOME</li>
|
<li><a href="{% url 'index' %}">HOME</a></li>
|
||||||
<li>ABOUT</li>
|
<li><a href="{% url 'about' %}">ABOUT</a></li>
|
||||||
<li><a href="/project">PROJECTS</a></li>
|
<li><a href="{% url 'projects' %}">PROJECTS</a></li>
|
||||||
<li>EVENTS</li>
|
<li><a href="{% url 'events' %}">EVENTS</a></li>
|
||||||
<li>WORKS</li>
|
<li><a href="{% url 'works' %}">WORKS</a></li>
|
||||||
<li>TEXTS</li>
|
<li><a href="{% url 'texts' %}">TEXTS</a></li>
|
||||||
<li>CONTACT</li>
|
<li><a href="{% url 'contact' %}">CONTACT</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -43,12 +43,8 @@
|
||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<script src="{% static "js/jquery.js" %}"></script>
|
<script src="{% static "js/jquery.js" %}"></script>
|
||||||
<script src="{% static "js/app.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/what-input.js" %}"></script>
|
<script src="{% static "js/what-input.js" %}"></script>
|
||||||
<script>
|
|
||||||
$(document).foundation();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<img src="http://camputer.org/images/{{ content.image }}" width="75%">
|
<img src="{{ content.image_url }}" width="75%">
|
||||||
<div class="content_detail">
|
<div class="content_detail">
|
||||||
<h1>{{ content.title }}</h1>
|
<h1>{{ content.title }}</h1>
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,12 @@
|
||||||
{% for content in latest_content_list %}
|
{% for content in latest_content_list %}
|
||||||
{% if forloop.counter == 3 %}
|
{% if forloop.counter == 3 %}
|
||||||
<div class="large-8 medium-8 columns special-column">
|
<div class="large-8 medium-8 columns special-column">
|
||||||
<img src="http://camputer.org/images/{{content.image}}">
|
<img src="{{ content.image_url }}">
|
||||||
<div class="index-text">
|
<div class="index-text">
|
||||||
<h4><a href="/content/{{ content.shortname }}/">{{content.title}} </a></h4>
|
<h4><a href="{{ content.get_absolute_url }}">{{content.title}}</a></h4>
|
||||||
<h6>Tate Modern <br />
|
<p>
|
||||||
29th March, 2017, 7:00 pm <br />
|
{{content.body|striptags|truncatechars:250}} <a href="{{ content.get_absolute_url }}">read more</a>
|
||||||
South Tank <br /> </h6>
|
</p>
|
||||||
|
|
||||||
<p> {{content.body|striptags|truncatechars:250}} <a href="/content/{{ content.shortname }}">read more</a> </p>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -27,12 +25,12 @@
|
||||||
{% for content in latest_content_list %}
|
{% for content in latest_content_list %}
|
||||||
<div class="row right-items">
|
<div class="row right-items">
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
<img src="http://camputer.org/images/{{ content.image }}">
|
<img src="{{ content.image_url }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
<a href="/content/{{ content.shortname }}/" class="sidebar-title">{{ content.title }}</a>
|
<a href="{{ content.get_absolute_url }}" class="sidebar-title">{{ content.title }}</a>
|
||||||
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{ content.datestart }} </b></font> <br/>
|
<h6 class="sidebar-date">{{ content.datestart }}</h6>
|
||||||
We will add a place to fill this text </h6>
|
{{ conntent.header }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
{% extends 'base.html' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="large-4 medium-4 columns">
|
|
||||||
<h4 class="sidebar-h4"> Upcoming Events </h4>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
{% for content in content %}
|
|
||||||
<div class="row right-items">
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<img src="http://camputer.org/images/{{ content.image }}">
|
|
||||||
</div>
|
|
||||||
<div class="small-6 columns">
|
|
||||||
<a href="/content/{{ content.shortname }}/" class="sidebar-title">{{ content.title }}</a>
|
|
||||||
<h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{ content.datestart }} </b></font> <br/>
|
|
||||||
We will add a place to fill this text </h6>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
22
content/templates/projects.html
Normal file
22
content/templates/projects.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% 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 %}
|
|
@ -1,10 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404, render, redirect
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
from .models import Content
|
from .models import Content
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
latest_content_list = Content.objects.order_by('-datestart')[:5]
|
latest_content_list = Content.objects.order_by('-datestart')[:5]
|
||||||
|
@ -12,9 +13,62 @@ def index(request):
|
||||||
return render(request, 'index.html', context)
|
return render(request, 'index.html', context)
|
||||||
|
|
||||||
def content(request, shortname):
|
def content(request, shortname):
|
||||||
content = get_object_or_404(Content, shortname = shortname)
|
content = get_object_or_404(Content, shortname=shortname)
|
||||||
return render(request, 'detail.html', {'content': content})
|
return render(request, 'detail.html', {'content': content})
|
||||||
|
|
||||||
def project(request):
|
def projects(request):
|
||||||
content = Content.objects.filter(type=3)
|
content = Content.objects.filter(type__name='ongoing').exclude(shortname='').order_by('-datestart')
|
||||||
return render(request, 'project.html', {'content': content})
|
return render(request, 'projects.html', {
|
||||||
|
'content': content,
|
||||||
|
'title': 'Projects'
|
||||||
|
})
|
||||||
|
|
||||||
|
def events(request):
|
||||||
|
content = Content.objects.filter(type__name='events').exclude(shortname='')
|
||||||
|
content = Content.objects.filter(type__name='events').exclude(shortname='').order_by('-datestart')
|
||||||
|
return render(request, 'projects.html', {
|
||||||
|
'content': content,
|
||||||
|
'title': 'Upcoming Events'
|
||||||
|
})
|
||||||
|
|
||||||
|
def works(request):
|
||||||
|
content = Content.objects.filter(type__name='works').exclude(shortname='').order_by('-datestart')
|
||||||
|
return render(request, 'projects.html', {
|
||||||
|
'content': content,
|
||||||
|
'title': 'Works'
|
||||||
|
})
|
||||||
|
|
||||||
|
def texts(request):
|
||||||
|
content = Content.objects.filter(type__name='texts').exclude(shortname='')
|
||||||
|
return render(request, 'projects.html', {
|
||||||
|
'content': content,
|
||||||
|
'title': 'Texts'
|
||||||
|
})
|
||||||
|
|
||||||
|
def about(request):
|
||||||
|
content = get_object_or_404(Content, shortname='about')
|
||||||
|
return render(request, 'detail.html', {'content': content})
|
||||||
|
|
||||||
|
def contact(request):
|
||||||
|
content = get_object_or_404(Content, shortname='contact')
|
||||||
|
return render(request, 'detail.html', {'content': content})
|
||||||
|
|
||||||
|
|
||||||
|
def redirect_index(request):
|
||||||
|
segment = request.GET.get('show')
|
||||||
|
if segment == 'pastevents':
|
||||||
|
return redirect(reverse('works'))
|
||||||
|
elif segment == 'contact':
|
||||||
|
return redirect(reverse('contact'))
|
||||||
|
return redirect(reverse('index'))
|
||||||
|
|
||||||
|
def redirect_event(request):
|
||||||
|
shortname = request.GET.get('this')
|
||||||
|
if shortname:
|
||||||
|
return redirect(reverse('content', kwargs={'shortname': shortname}))
|
||||||
|
id = request.GET.get('id')
|
||||||
|
if id:
|
||||||
|
content = get_object_or_404(Content, id=id)
|
||||||
|
return redirect(reverse('content', kwargs={'shortname': content.shortname}))
|
||||||
|
|
||||||
|
return redirect(reverse('events'))
|
||||||
|
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
django
|
Loading…
Reference in New Issue
Block a user