cablegates/pandora/app/views.py

44 lines
1.5 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django.template import RequestContext
2009-10-05 01:48:18 +02:00
from django.conf import settings
from ox.django.shortcuts import json_response, render_to_json_response, get_object_or_404_json
2010-02-10 18:40:14 +05:30
import models
2010-11-08 17:34:25 +01:00
from api.views import html_snapshot
from item.models import siteJson
2010-08-24 19:16:33 +02:00
def intro(request):
context = RequestContext(request, {'settings':settings})
return render_to_response('intro.html', context)
def index(request):
2010-02-08 15:56:25 +05:30
context = RequestContext(request, {'settings':settings})
if request.GET.get('_escaped_fragment_', None):
return html_snapshot(request)
return render_to_response('index.html', context)
def timeline(request):
context = RequestContext(request, {'settings':settings})
return render_to_response('timeline.html', context)
2010-02-10 18:40:14 +05:30
def api_getPage(request):
data = json.loads(request.POST['data'])
name = data['page']
page = get_object_or_404_json(models.Archive, name=name)
response = json_response({'name': page.name, 'body': page.body})
return render_to_json_response(response)
2010-11-06 17:18:12 +01:00
def site_json(request):
return render_to_json_response(siteJson())
'''
2010-09-07 15:08:23 +02:00
siteSettings = {}
for s in models.SiteSettings.objects.all():
siteSettings[s.key] = s.value
context = RequestContext(request, {'settings':settings, 'siteSettings': siteSettings})
2010-11-06 17:18:12 +01:00
return render_to_response('site.json', context, mimetype="application/javascript")
'''