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
This commit is contained in:
parent
8ef5ca240a
commit
b752f12121
@ -12,12 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from adjutant_ui.content.email import views
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', views.EmailView.as_view(), name='index'))
|
||||
urlpatterns = [
|
||||
url(r'^$', views.EmailView.as_view(), name='index')
|
||||
]
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends 'forgot_password/_forgot_password_form.html' %}
|
||||
|
||||
{% load url from future %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block pre_login %}
|
||||
|
@ -12,14 +12,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from adjutant_ui.content.forgot_password import views
|
||||
|
||||
# NOTE(adriant): These urls are registered in the project_users urls.py file.
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^/?$', views.ForgotPasswordView.as_view(), name='forgot_index'),
|
||||
urlpatterns = [
|
||||
url(r'^$', views.ForgotPasswordView.as_view(), name='forgot_index'),
|
||||
url(r'^sent/?$', views.password_sent_view, name='forgot_sent'),
|
||||
)
|
||||
]
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block modal_id %}invite_user_form{% endblock %}
|
||||
{% block modal-header %}{% trans "Invite User" %}{% endblock %}
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block modal_id %}update_user_form{% endblock %}
|
||||
{% block modal-header %}{% trans "Update User" %}{% endblock %}
|
||||
|
@ -12,17 +12,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from adjutant_ui.content.project_users import views
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
urlpatterns = [
|
||||
url(r'^invite/$', views.InviteUserView.as_view(), name='invite'),
|
||||
url(r'^(?P<user_id>[^/]+)/update/$',
|
||||
views.UpdateUserView.as_view(),
|
||||
name='update'),
|
||||
url(r'^$', views.UsersView.as_view(), name='index')
|
||||
)
|
||||
]
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends 'signup/_signup_form.html' %}
|
||||
|
||||
{% load url from future %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block pre_login %}
|
||||
|
@ -12,13 +12,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from adjutant_ui.content.signup import views
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^/?$', views.SignupFormView.as_view(), name='index'),
|
||||
urlpatterns = [
|
||||
url(r'^$', views.SignupFormView.as_view(), name='index'),
|
||||
url(r'^submitted/?$', views.signup_sent_view, name='submitted'),
|
||||
)
|
||||
]
|
||||
|
@ -12,18 +12,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from adjutant_ui.content.tasks import views
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
urlpatterns = [
|
||||
url(r'^(?P<task_id>[^/]+)/$',
|
||||
views.TaskDetailView.as_view(),
|
||||
name='detail'),
|
||||
url(r'^(?P<task_id>[^/]+)/update/$',
|
||||
views.UpdateTaskView.as_view(), name='update'),
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
)
|
||||
]
|
||||
|
@ -12,14 +12,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from adjutant_ui.content.token import views
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
urlpatterns = [
|
||||
url(r'^(?P<token>\w+)/?$', views.submit_token_router,
|
||||
name='token_verify'),
|
||||
)
|
||||
]
|
||||
|
@ -7,3 +7,27 @@ 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
|
||||
|
@ -9,6 +9,6 @@
|
||||
# PBR should always appear first
|
||||
pbr>=2.0.0 # Apache-2.0
|
||||
Babel>=2.3.4 # BSD
|
||||
Django<1.9,>=1.8 # BSD
|
||||
Django<1.12,>=1.8 # BSD
|
||||
django-babel>=0.5.1 # BSD
|
||||
django-overextends>=0.4.2
|
||||
|
Loading…
Reference in New Issue
Block a user