adjutant-ui/adjutant_ui/enabled/_6001_adjutant_base.py
Amelia Cordwell b752f12121 Fixes for Django 1.10 compatabililty
* Removed {% load url from future %}, deprecated in 1.7 removed
in 1.9. See [1]
* Removed urlpatterns() from url file. Deprecated 1.8 removed
1.10. See [2]
* django 1.9+ overextends builtins need adding to settings,
  but 1.10+ we can use native django features. Will remove
  overextends when we drop support for anything less than django 1.11

[1] https://docs.djangoproject.com/en/1.9/releases/1.7/#loading-ssi-and-url-template-tags-from-future-library
[2] https://docs.djangoproject.com/en/1.10/releases/1.8/#django-conf-urls-patterns

Change-Id: Ief7dc4d5025284b0fc26a6386c1c41e0d701fe23
2017-09-07 17:04:39 +12:00

34 lines
1.1 KiB
Python

# Making use of this to make a generic enabled file
# to load base adjutant-ui content.
FEATURE = "adjutant-ui-base"
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
'adjutant_ui',
'overextends',
]
# TODO(adriant): Remove this and overextends when we drop django<1.11
from distutils.version import StrictVersion # noqa
import django # noqa
if StrictVersion(django.__version__) >= StrictVersion("1.9"):
from openstack_dashboard.settings import TEMPLATES as _TEMPLATES
_builtin = 'overextends.templatetags.overextends_tags'
_template_backend = 'django.template.backends.django.DjangoTemplates'
for _backend in _TEMPLATES:
if _backend['BACKEND'] == _template_backend:
if 'OPTIONS' in _backend:
try:
if _builtin not in _backend['OPTIONS']['builtins']:
_backend['OPTIONS']['builtins'].append(_builtin)
except KeyError:
_backend['OPTIONS']['builtins'] = [_builtin, ]
else:
_backend['OPTIONS'] = {
'builtins': [_builtin, ]
}
break