mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
layerindex: Add support for rrs in settings.py and urls.py
settings.py: Add APPLICATION variable to switch between layerindex rrs also add context_processors decision layerindex or rrs. urls.py: Add decision for load urls for layerindex or rrs. layerindex/context_processors.py: Add application variable for use templates. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
parent
eae7b91a11
commit
36d5746acd
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
# Licensed under the MIT license, see COPYING.MIT for details
|
# Licensed under the MIT license, see COPYING.MIT for details
|
||||||
|
|
||||||
|
import settings
|
||||||
from layerindex.models import Branch, LayerItem
|
from layerindex.models import Branch, LayerItem
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
|
|
||||||
|
@ -17,5 +18,6 @@ def layerindex_context(request):
|
||||||
'all_branches': Branch.objects.exclude(name='oe-classic').order_by('sort_priority'),
|
'all_branches': Branch.objects.exclude(name='oe-classic').order_by('sort_priority'),
|
||||||
'unpublished_count': LayerItem.objects.filter(status='N').count(),
|
'unpublished_count': LayerItem.objects.filter(status='N').count(),
|
||||||
'oe_classic': Branch.objects.filter(name='oe-classic'),
|
'oe_classic': Branch.objects.filter(name='oe-classic'),
|
||||||
'site_name': site_name
|
'site_name': site_name,
|
||||||
|
'application' : settings.APPLICATION
|
||||||
}
|
}
|
23
settings.py
23
settings.py
|
@ -6,6 +6,8 @@
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
||||||
|
APPLICATION = 'layerindex' # rrs or layerindex
|
||||||
|
|
||||||
ADMINS = (
|
ADMINS = (
|
||||||
# ('Your Name', 'your_email@example.com'),
|
# ('Your Name', 'your_email@example.com'),
|
||||||
)
|
)
|
||||||
|
@ -120,10 +122,18 @@ CORS_URLS_REGEX = r'.*/api/.*';
|
||||||
X_FRAME_OPTIONS = 'DENY'
|
X_FRAME_OPTIONS = 'DENY'
|
||||||
|
|
||||||
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
|
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = TCP + (
|
if APPLICATION == 'layerindex':
|
||||||
|
TEMPLATE_CONTEXT_PROCESSORS = TCP + (
|
||||||
'django.core.context_processors.request',
|
'django.core.context_processors.request',
|
||||||
'layerindex.context_processors.layerindex_context',
|
'layerindex.context_processors.layerindex_context',
|
||||||
)
|
)
|
||||||
|
elif APPLICATION == 'rrs':
|
||||||
|
TEMPLATE_CONTEXT_PROCESSORS = TCP + (
|
||||||
|
'django.core.context_processors.request',
|
||||||
|
'rrs.context_processors.rrs_context',
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise ValueError('Unknown APPLICATION should be layerindex or rrs')
|
||||||
|
|
||||||
ROOT_URLCONF = 'urls'
|
ROOT_URLCONF = 'urls'
|
||||||
|
|
||||||
|
@ -146,6 +156,8 @@ INSTALLED_APPS = (
|
||||||
# Uncomment the next line to enable admin documentation:
|
# Uncomment the next line to enable admin documentation:
|
||||||
# 'django.contrib.admindocs',
|
# 'django.contrib.admindocs',
|
||||||
'layerindex',
|
'layerindex',
|
||||||
|
# Uncomment when APPLICATION is RRS
|
||||||
|
#'rrs',
|
||||||
'registration',
|
'registration',
|
||||||
'reversion',
|
'reversion',
|
||||||
'reversion_compare',
|
'reversion_compare',
|
||||||
|
@ -215,3 +227,10 @@ CORE_LAYER_NAME = "openembedded-core"
|
||||||
# Settings for layer submission feature
|
# Settings for layer submission feature
|
||||||
SUBMIT_EMAIL_FROM = 'noreply@example.com'
|
SUBMIT_EMAIL_FROM = 'noreply@example.com'
|
||||||
SUBMIT_EMAIL_SUBJECT = 'OE Layerindex layer submission'
|
SUBMIT_EMAIL_SUBJECT = 'OE Layerindex layer submission'
|
||||||
|
|
||||||
|
# Settings for Recipe reporting system
|
||||||
|
POKY_REPO_URL = "git://git.yoctoproject.org/poky"
|
||||||
|
|
||||||
|
RRS_EMAIL_SUBJECT = '[Recipe reporting system] Upgradable recipe name list'
|
||||||
|
RRS_EMAIL_FROM = 'recipe-report@yoctoproject.org'
|
||||||
|
RRS_EMAIL_TO = 'list@example.com'
|
||||||
|
|
14
urls.py
14
urls.py
|
@ -5,6 +5,8 @@
|
||||||
# Copyright (c) Django Software Foundation and individual contributors.
|
# Copyright (c) Django Software Foundation and individual contributors.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
||||||
|
import settings
|
||||||
|
|
||||||
from django.conf.urls.defaults import patterns, include, url
|
from django.conf.urls.defaults import patterns, include, url
|
||||||
from django.views.generic.simple import redirect_to
|
from django.views.generic.simple import redirect_to
|
||||||
|
|
||||||
|
@ -12,10 +14,18 @@ from django.contrib import admin
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^layerindex/', include('layerindex.urls')),
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
url(r'^accounts/', include('registration.backends.default.urls')),
|
url(r'^accounts/', include('registration.backends.default.urls')),
|
||||||
url(r'^captcha/', include('captcha.urls')),
|
url(r'^captcha/', include('captcha.urls')),
|
||||||
url(r'.*', redirect_to, {'url' : '/layerindex/'})
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if settings.APPLICATION == 'layerindex':
|
||||||
|
urlpatterns += patterns('',
|
||||||
|
url(r'^layerindex/', include('layerindex.urls')),
|
||||||
|
url(r'.*', redirect_to, {'url' : '/layerindex/'}),
|
||||||
|
)
|
||||||
|
elif settings.APPLICATION == 'rrs':
|
||||||
|
urlpatterns += patterns('',
|
||||||
|
url(r'^rrs/', include('rrs.urls')),
|
||||||
|
url(r'.*', redirect_to, {'url' : '/rrs/'}),
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user