aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/context_processors.py
blob: c21c4a9161b855ff6bb84473646edeb87dd767e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# layerindex-web - custom context processor
#
# Copyright (C) 2013 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details

from layerindex.models import Branch, LayerItem
from django.contrib.sites.models import Site

def layerindex_context(request):
    site = Site.objects.get_current()
    if site and site.name and site.name != 'example.com':
        site_name = site.name
    else:
        site_name = 'OpenEmbedded Layer Index'
    return {
        'all_branches': Branch.objects.exclude(name='oe-classic').order_by('sort_priority'),
        'unpublished_count': LayerItem.objects.filter(status='N').count(),
        'oe_classic': Branch.objects.filter(name='oe-classic'),
        'site_name': site_name
    }