layerindex-web/layerindex/context_processors.py
Paul Eggleton 9ebc94a1df Add a link from the Tools drop-down to the RRS if enabled
If the RRS is enabled, then add a link to it in the tools menu. I don't
expect this to be used a lot, but otherwise the only way you'd get there
would be either externally or via the link from the layer detail.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:53 +12:00

24 lines
820 B
Python

# 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):
import settings
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,
'rrs_enabled': 'rrs' in settings.INSTALLED_APPS,
}