Fixes to match Horizon Rocky

Horizon in Rocky 'fixed' recursive inheritance but this
in turn broke our use of overextends. As such we drop
overextends for Rocky onwards, but this means Adjutant-UI
from Rocky onwards only works with Horizon from Rocky onwards.

This also fixes issues with quota naming cleanup which was
changed in Horizon proper.

Change-Id: I60fa4e8e751bb62760830e37775c42b9900fb59c
This commit is contained in:
Adrian Turjak 2018-05-02 12:50:03 +12:00
parent 479618c775
commit bb878a3f33
6 changed files with 18 additions and 31 deletions

View File

@ -1,4 +1,4 @@
{% overextends 'auth/_login_page.html' %}
{% extends 'auth/_login_page.html' %}
{% load i18n %}
{% block login_footer %}

View File

@ -20,7 +20,9 @@ from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from openstack_dashboard.dashboards.admin.defaults.tables import get_quota_name
from openstack_dashboard.dashboards.admin.defaults.tables import (
get_compute_quota_name, get_volume_quota_name, get_network_quota_name
)
from adjutant_ui.api import adjutant
@ -35,6 +37,17 @@ def display_as_percent(value):
return '{:.1%}'.format(value)
def get_quota_name(quota):
if quota.service == "nova":
return get_compute_quota_name(quota)
if quota.service == "cinder":
return get_volume_quota_name(quota)
if quota.service == "neutron":
return get_network_quota_name(quota)
return quota.name.replace("_", " ").title()
class UpdateQuota(tables.LinkAction):
name = "update"
verbose_name = _("Update Quota")

View File

@ -1,4 +1,4 @@
{% overextends 'auth/_login_page.html' %}
{% extends 'auth/_login_page.html' %}
{% load i18n %}
{% block login_footer %}

View File

@ -5,29 +5,4 @@ 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

View File

@ -1,4 +1,4 @@
{% overextends 'auth/_login_page.html' %}
{% extends 'auth/_login_page.html' %}
{% load i18n %}
{% load relabel_username_field %}

View File

@ -9,6 +9,5 @@
# PBR should always appear first
pbr>=2.0.0 # Apache-2.0
Babel>=2.3.4 # BSD
Django<1.12,>=1.8 # BSD
Django<1.12,>=1.11 # BSD
django-babel>=0.5.1 # BSD
django-overextends>=0.4.2