aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/context_processors.py
blob: 44f1f801416f916766ceaa78afb1eccf5ec3a018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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

def layerindex_context(request):
    current_branch = request.session.get('branch', None)
    if not current_branch:
        current_branch = 'master'
    return {
        'all_branches': Branch.objects.all().order_by('sort_priority'),
        'current_branch': current_branch,
        'unpublished_count': LayerItem.objects.filter(status='N').count(),
    }