2017-05-20 12:45:26 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
2017-06-10 09:59:00 +00:00
|
|
|
from django.http import HttpResponse
|
|
|
|
from django.shortcuts import get_object_or_404, render
|
|
|
|
from .models import Content
|
2017-05-20 12:45:26 +00:00
|
|
|
|
|
|
|
# Create your views here.
|
2017-06-10 09:59:00 +00:00
|
|
|
|
|
|
|
def index(request):
|
|
|
|
latest_content_list = Content.objects.order_by('-datestart')[:5]
|
|
|
|
context = {'latest_content_list': latest_content_list}
|
|
|
|
return render(request, 'index.html', context)
|
|
|
|
|
|
|
|
def content(request, shortname):
|
|
|
|
content = get_object_or_404(Content, shortname = shortname)
|
|
|
|
return render(request, 'detail.html', {'content': content})
|
|
|
|
|
|
|
|
def project(request):
|
|
|
|
content = Content.objects.filter(type=3)
|
|
|
|
return render(request, 'project.html', {'content': content})
|