views.py 640 Bytes
Newer Older
chirac's avatar
chirac committed
1
from django.shortcuts import render
2 3
from django.shortcuts import get_object_or_404
from django.template.context_processors import csrf
chirac's avatar
chirac committed
4 5 6 7 8 9
from django.template import Context, RequestContext, loader
from re2o.settings import services_urls

def form(ctx, template, request):
    c = ctx
    c.update(csrf(request))
10
    return render(request, template, c)
chirac's avatar
chirac committed
11 12 13


def index(request):
lhark's avatar
lhark committed
14 15 16 17 18 19 20 21 22
    i = 0
    services = [{}]
    for key, s in services_urls.items():
        if len(services) <= i:
            services += [{}]
        services[i][key] = s
        i = i + 1 if i < 2 else 0

    return form({'services_urls': services}, 're2o/index.html', request)