Update to Django 1.9

- update all dependencies
- fix deprecation warnings and errors for Django 1.9 compatibility
This commit is contained in:
Jan Dittberner 2015-12-19 20:11:23 +01:00
parent 1b30b1a38c
commit 085b126416
21 changed files with 85 additions and 110 deletions

View file

@ -4,7 +4,7 @@ URL patterns for the contact_form views.
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
ContactFormView,
@ -12,8 +12,7 @@ from .views import (
)
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', ContactFormView.as_view(), name='contact_form'),
url(r'^success/$', ContactSuccessView.as_view(), name='contact_success'),
)
]

View file

@ -1,6 +1,6 @@
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
IndexView,
@ -8,9 +8,8 @@ from .views import (
)
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', IndexView.as_view(), name='dashboard'),
url(r'^user/(?P<slug>[\w0-9@.+-_]+)/$',
UserDashboardView.as_view(), name='customer_dashboard'),
)
]

View file

@ -50,7 +50,6 @@ DNS_TSIG_KEY_ALGORITHMS = Choices(
)
@python_2_unicode_compatible
class DomainBase(TimeStampedModel):
"""
This is the base model for domains.
@ -64,9 +63,6 @@ class DomainBase(TimeStampedModel):
class Meta:
abstract = True
def __str__(self):
return self.domain
@python_2_unicode_compatible
class MailDomain(DomainBase):

View file

@ -9,7 +9,7 @@ from mock import MagicMock, Mock, patch
from django.core.urlresolvers import reverse
from django.forms import ValidationError
from django.test import TestCase
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext as _
from domains.forms import relative_domain_validator, CreateHostingDomainForm

View file

@ -17,7 +17,6 @@ from domains.models import (
DNSRecord,
DNSSupermaster,
DNSTSIGKey,
DomainBase,
HostingDomain,
MailDomain,
)
@ -32,13 +31,6 @@ User = get_user_model()
TEST_USER = 'test'
class DomainBaseTest(TestCase):
def test___str__(self):
db = DomainBase(domain='test')
self.assertEqual(str(db), 'test')
class MailDomainTest(TestCase):
def test___str__(self):
@ -48,8 +40,7 @@ class MailDomainTest(TestCase):
def test_get_mailaddresses(self):
md = MailDomain.objects.create(domain='example.org')
from managemails.models import MailAddress
addrmock = MailAddress(localpart='info')
md.mailaddress_set.add(addrmock)
addrmock = MailAddress.objects.create(localpart='info', domain=md)
self.assertIn(addrmock, md.get_mailaddresses())
self.assertIn(addrmock, md.mailaddresses)

View file

@ -4,13 +4,12 @@ This module defines the URL patterns for domain related views.
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import CreateHostingDomain
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^(?P<package>\d+)/create$', CreateHostingDomain.as_view(),
name='create_hosting_domain'),
)
]

View file

@ -46,9 +46,6 @@ path.append(DJANGO_ROOT)
# ######### DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = False
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
# ######### END DEBUG CONFIGURATION
@ -158,34 +155,31 @@ FIXTURE_DIRS = (
# ######### TEMPLATE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors # noqa
TEMPLATE_CONTEXT_PROCESSORS = (
# See: https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-TEMPLATES # noqa
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
normpath(join(SITE_ROOT, 'templates')),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
# allauth specific context processors
'allauth.account.context_processors.account',
'allauth.socialaccount.context_processors.socialaccount',
'django.template.context_processors.request',
# custom context processors
'gnuviechadmin.context_processors.navigation',
'gnuviechadmin.context_processors.version_info',
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
TEMPLATE_DIRS = (
normpath(join(SITE_ROOT, 'templates')),
)
],
},
},
]
# ######### END TEMPLATE CONFIGURATION

View file

@ -13,7 +13,7 @@ from .base import * # NOQA
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
# ######### END DEBUG CONFIGURATION

View file

@ -1,13 +1,13 @@
from __future__ import absolute_import
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from django.contrib.flatpages import views
admin.autodiscover()
urlpatterns = patterns(
'',
urlpatterns = [
url(r'', include('dashboard.urls')),
url(r'^accounts/', include('allauth.urls')),
url(r'^database/', include('userdbs.urls')),
@ -16,19 +16,18 @@ urlpatterns = patterns(
url(r'^website/', include('websites.urls')),
url(r'^mail/', include('managemails.urls')),
url(r'^osuser/', include('osusers.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
url(r'^contact/', include('contact_form.urls')),
)
urlpatterns += patterns(
'django.contrib.flatpages.views',
url(r'^impressum/$', 'flatpage', {'url': '/impressum/'}, name='imprint'),
)
url(r'^impressum/$', views.flatpage, {
'url': '/impressum/'
}, name='imprint'),
]
# Uncomment the next line to serve media files in dev.
# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG: # pragma: no cover
import debug_toolbar
urlpatterns += patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)),
)
urlpatterns += [
url(r'^__debug__/', debug_toolbar.urls),
]

View file

@ -4,7 +4,7 @@ This module defines the URL patterns for hosting package related views.
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
AddHostingOption,
@ -17,8 +17,7 @@ from .views import (
)
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^create$', CreateHostingPackage.as_view(),
name='create_hosting_package'),
url(r'^allpackages/',
@ -35,4 +34,4 @@ urlpatterns = patterns(
HostingOptionChoices.as_view(), name='hosting_option_choices'),
url(r'^(?P<package>\d+)/add-option/(?P<type>\w+)/(?P<optionid>\d+)$',
AddHostingOption.as_view(), name='add_hosting_option'),
)
]

View file

@ -32,7 +32,7 @@ class ReadOnlyPasswordHashField(forms.Field):
def bound_data(self, data, initial):
return initial
def _has_changed(self, initial, data):
def has_changed(self, initial, data):
return False

View file

@ -52,7 +52,7 @@ class ReadOnlyPasswordHashFieldTest(TestCase):
def test__has_changed(self):
field = ReadOnlyPasswordHashField()
self.assertFalse(field._has_changed('new', 'old'))
self.assertFalse(field.has_changed('new', 'old'))
class CustomerTestCase(TestCase):

View file

@ -5,7 +5,7 @@ views.
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
AddMailAddress,
@ -15,8 +15,7 @@ from .views import (
EditMailAddress,
)
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^(?P<package>\d+)/mailbox/create$',
CreateMailbox.as_view(), name='create_mailbox'),
url(r'^(?P<package>\d+)/mailbox/(?P<slug>[\w0-9]+)/setpassword$',
@ -29,4 +28,4 @@ urlpatterns = patterns(
url(r'^(?P<package>\d+)/mailaddress/(?P<domain>[\w0-9-.]+)/(?P<pk>\d+)'
r'/delete$',
DeleteMailAddress.as_view(), name='delete_mailaddress'),
)
]

View file

@ -4,7 +4,7 @@ This module defines the URL patterns for operating system user related views.
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
AddSshPublicKey,
@ -15,8 +15,7 @@ from .views import (
)
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^(?P<slug>[\w0-9@.+-_]+)/setpassword$', SetOsUserPassword.as_view(),
name='set_osuser_password'),
url(r'^(?P<package>\d+)/ssh-keys/$', ListSshPublicKeys.as_view(),
@ -27,4 +26,4 @@ urlpatterns = patterns(
EditSshPublicKeyComment.as_view(), name='edit_ssh_key_comment'),
url(r'^(?P<package>\d+)/ssh-keys/(?P<pk>\d+)/delete$',
DeleteSshPublicKey.as_view(), name='delete_ssh_key'),
)
]

View file

@ -1,11 +1,12 @@
{% extends "account/base.html" %}
{% load account crispy_forms_tags i18n %}
{% load account socialaccount crispy_forms_tags i18n %}
{% block title %}{{ block.super }} - {% trans "Sign In" %}{% endblock title %}
{% block page_title %}{% trans "Sign In" %}{% endblock page_title %}
{% block content %}
{% if socialaccount.providers %}
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
<p>{% blocktrans with site.name as site_name %}Please sign in with one
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
for a {{site_name}} account and sign in below:{% endblocktrans %}</p>

View file

@ -1,6 +1,7 @@
{% load socialaccount %}
{% for provider in socialaccount.providers %}
{% get_providers as socialaccount_providers %}
{% for provider in socialaccount_providers %}
{% if provider.id == "openid" %}
{% for brand in provider.get_brands %}
<li>

View file

@ -4,7 +4,7 @@ This module defines the URL patterns for user database views.
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
AddUserDatabase,
@ -12,12 +12,11 @@ from .views import (
DeleteUserDatabase,
)
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^(?P<package>\d+)/create$',
AddUserDatabase.as_view(), name='add_userdatabase'),
url(r'^(?P<package>\d+)/(?P<slug>[\w0-9]+)/setpassword',
ChangeDatabaseUserPassword.as_view(), name='change_dbuser_password'),
url(r'^(?P<package>\d+)/(?P<slug>[\w0-9]+)/delete',
DeleteUserDatabase.as_view(), name='delete_userdatabase'),
)
]

View file

@ -4,7 +4,7 @@ This module defines the URL patterns for website related views.
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
AddWebsite,
@ -12,10 +12,9 @@ from .views import (
)
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^(?P<package>\d+)/(?P<domain>[\w0-9.-]+)/create$',
AddWebsite.as_view(), name='add_website'),
url(r'^(?P<package>\d+)/(?P<domain>[\w0-9.-]+)/(?P<pk>\d+)/delete$',
DeleteWebsite.as_view(), name='delete_website'),
)
]

View file

@ -1,19 +1,20 @@
Django==1.8.6
Django==1.9
curtsies==0.1.21
bpython==0.14.2
django-braces==1.8.1
django-model-utils==2.3.1
django-model-utils==2.4
django-crispy-forms==1.5.2
logutils==0.3.3
psycopg2==2.6.1
passlib==1.6.5
celery==3.1.18
billiard==3.3.0.20
kombu==3.0.27
pytz==2015.6
celery==3.1.19
billiard==3.3.0.22
kombu==3.0.32
pytz==2015.7
pyaml==15.8.2
django-allauth==0.21.0
django-allauth==0.24.1
oauthlib==1.0.3
python-openid==2.2.5
requests==2.5.1
requests-oauthlib==0.5.0
simplejson==3.8.0
requests==2.9.0
requests-oauthlib==0.6.0
simplejson==3.8.1

View file

@ -1,7 +1,7 @@
# Local development dependencies go here
-r test.txt
django-debug-toolbar==1.4
sqlparse==0.1.16
Sphinx==1.3.1
sqlparse==0.1.18
Sphinx==1.3.3
snowballstemmer==1.2.0
releases==0.7.0
releases==1.0.0

View file

@ -1,4 +1,4 @@
# Test dependencies go here.
-r base.txt
coverage==4.0
coverage==4.0.3
mock==1.3.0