context_processors.py 755 Bytes
Newer Older
1
from memopol_settings.models import Setting
2
from representatives.models import Chamber, Group
3 4 5 6


def search_form_options(request):
    d = {}
Nicolas Joyard's avatar
Nicolas Joyard committed
7 8
    # Note: Those queries needs to be eval in the template so that we can cache
    # it efficiently
9

10
    d['chambers'] = Chamber.objects.all()
11 12 13 14 15 16
    d['countries'] = Group.objects.filter(kind='country')
    d['parties'] = Group.objects.filter(kind='group')
    d['delegations'] = Group.objects.filter(kind='delegation')
    d['committees'] = Group.objects.filter(kind='committee')

    return d
17 18 19 20 21 22 23 24 25 26


def intro_text(request):
    d = {}

    for s in Setting.objects.filter(pk__in=['HOMEPAGE_INTRO_TEXT',
                                            'HOMEPAGE_INSTANCE_TEXT']):
        d[s.pk] = s.comment

    return d