Update to Django 1.11 LTS, fixes #293

This commit is contained in:
Fabian Weisshaar 2017-05-27 00:55:55 +02:00
parent 7c05b67e80
commit 55f47ff52d
14 changed files with 47 additions and 47 deletions

View File

@ -62,4 +62,4 @@ class Version(tuple): # pragma: no cover
return version_str
version = Version(0, 12, 0)
version = Version(0, 13, 0)

View File

@ -14,7 +14,7 @@
{{ form|bootstrap_horizontal:"col-sm-3 col-lg-3" }}
<div class="form-group">
<div class="col-sm-offset-3 col-sm-8">
<input type="submit" class="btn btn-primary" value="{% trans 'Change my password' %}" /> <a href="{% url 'django.contrib.auth.views.password_reset' %}">{% trans 'Forgot your password?' %}</a>
<input type="submit" class="btn btn-primary" value="{% trans 'Change my password' %}" /> <a href="{% url 'password_reset' %}">{% trans 'Forgot your password?' %}</a>
</div>
</div>
</form>

View File

@ -1,4 +1,3 @@
from django.conf.urls import patterns
from django.conf.urls import url
from django.views.generic.base import TemplateView
@ -8,8 +7,7 @@ from registration.backends.default.views import RegistrationView
from .views import UserProfileView, DeleteUserView, UserChangePasswordView
urlpatterns = patterns(
'',
urlpatterns = (
url(r'^profile/', UserProfileView.as_view(), name="account_profile"),
url(r'^settings/', UserChangePasswordView.as_view(), name='account_settings'),
url(r'^delete/', DeleteUserView.as_view(), name="account_delete"),

View File

@ -10,7 +10,7 @@
{% if form.errors %}
<p>{% trans "Your username and password didn't match. Please try again." %}</p>
{% endif %}
<form class="form-horizontal" role="form" method="post" action="{% url 'django.contrib.auth.views.login' %}">
<form class="form-horizontal" role="form" method="post" action="{% url 'login' %}">
{% csrf_token %}
{{ form|bootstrap_horizontal:"col-sm-3 col-lg-3" }}
<div class="form-group">
@ -21,7 +21,7 @@
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<input type="submit" class="btn btn-primary" value="{% trans 'Log in' %}" /> <a href="{% url 'django.contrib.auth.views.password_reset' %}">{% trans 'Forgot your password?' %}</a>
<input type="submit" class="btn btn-primary" value="{% trans 'Log in' %}" /> <a href="{% url 'password_reset' %}">{% trans 'Forgot your password?' %}</a>
<p></p>
<p><a href="{% url 'registration_register' %}">{% trans "Sign up for a new account..." %}</a></p>
</div>

View File

@ -6,7 +6,7 @@
<div class="container">
<div class="form-signin">
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
<p><a href="{% url 'django.contrib.auth.views.login' %}">{% trans 'Log in again' %}</a></p>
<p><a href="{% url 'login' %}">{% trans 'Log in again' %}</a></p>
</div>
</div>
{% endblock %}

View File

@ -1,21 +1,22 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls import url
from django.contrib.auth.views import login, logout_then_login, password_reset, password_reset_done, \
password_reset_confirm, password_reset_complete
urlpatterns = patterns(
'',
urlpatterns = (
# login and logout url
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'),
# or use 'django.contrib.auth.views.logout' with template 'logout.html
url(r'^logout/$', 'django.contrib.auth.views.logout_then_login', name='logout'),
url(r'^login/$', login, {'template_name': 'login.html'}, name='login'),
# or use logout with template 'logout.html'
url(r'^logout/$', logout_then_login, name='logout'),
# password reset urls
url(r'^password_reset/$', 'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html'}, name='password_reset'),
url(r'^password_reset_done/$', 'django.contrib.auth.views.password_reset_done',
url(r'^password_reset/$', password_reset, {'template_name': 'password_reset.html'},
name='password_reset'),
url(r'^password_reset_done/$', password_reset_done,
{'template_name': 'password_reset_done.html'}, name='password_reset_done'),
url(r'^password_reset_confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'}, name='password_reset_confirm'),
url(r'^password_reset_complete/$', 'django.contrib.auth.views.password_reset_complete',
password_reset_confirm, {'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^password_reset_complete/$', password_reset_complete,
{'template_name': 'password_reset_complete.html'}, name='password_reset_complete'),
)

View File

@ -2,7 +2,7 @@
main app url dispatching
"""
from django.conf.urls import patterns, url
from django.conf.urls import url
from .views import (
HomeView, OverviewView, HostView, AddHostView, DeleteHostView, AboutView, GenerateSecretView, GenerateNSSecretView,
@ -14,8 +14,7 @@ from ..api.views import (
NicDeleteView, AuthorizedNicDeleteView)
urlpatterns = patterns(
'',
urlpatterns = (
# interactive web ui
url(r'^$', HomeView.as_view(), name="home"),
url(r'^about/$', AboutView.as_view(), name="about"),

View File

@ -195,7 +195,7 @@ class OverviewView(TemplateView):
.only("name", "comment", "available", "client_faults", "server_faults", "abuse_blocked", "abuse",
"last_update_ipv4", "tls_update_ipv4", "last_update_ipv6", "tls_update_ipv6", "domain__name")
context['your_domains'] = Domain.objects.filter(
created_by=self.request.user).select_related("created_by__username")\
created_by=self.request.user).select_related("created_by__profile")\
.only("name", "public", "available", "comment", "created_by__username")
context['public_domains'] = Domain.objects.filter(
public=True).exclude(created_by=self.request.user).select_related("created_by")\
@ -215,7 +215,7 @@ class AddHostView(CreateView):
def get_success_url(self):
return reverse('generate_secret_view', args=(self.object.pk,))
def get_form(self, form_class):
def get_form(self, form_class=None):
form = super(AddHostView, self).get_form(form_class)
form.fields['domain'].queryset = Domain.objects.filter(
Q(created_by=self.request.user) | Q(public=True))
@ -347,7 +347,7 @@ class AddRelatedHostView(CreateView):
def get_success_url(self):
return reverse('related_host_overview', args=(self.object.main_host.pk, ))
def get_form(self, form_class):
def get_form(self, form_class=None):
form = super(AddRelatedHostView, self).get_form(form_class)
return form

View File

@ -264,8 +264,17 @@ SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_AGE = 14 * 24 * 60 * 60 # 14 days, in seconds (remember_me is True)
SESSION_EXPIRE_AT_BROWSER_CLOSE = True # more safe (remember_me is False)
# python-social-auth settings
# Allow SHA1 for host update secrets
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.Argon2PasswordHasher',
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.SHA1PasswordHasher',
]
# python-social-auth settings
AUTHENTICATION_BACKENDS = (
'social_core.backends.amazon.AmazonOAuth2',
'social_core.backends.bitbucket.BitbucketOAuth',

View File

@ -58,7 +58,7 @@
<ul class="nav navbar-nav pull-right">
{% if not request.user.is_authenticated %}
<li{% if nav_register %} class="active"{% endif %}><a href="{% url 'registration_register' %}"><i class="fa fa-asterisk fa-fw"></i> {% trans "Sign up" %}</a></li>
<li{% if nav_login %} class="active"{% endif %}><a href="{% url 'django.contrib.auth.views.login' %}"><i class="fa fa-sign-in fa-fw"></i> {% trans 'Log in' %}</a></li>
<li{% if nav_login %} class="active"{% endif %}><a href="{% url 'login' %}"><i class="fa fa-sign-in fa-fw"></i> {% trans 'Log in' %}</a></li>
{% else %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user fa-fw"></i> {{ request.user.username }} <b class="caret"></b></a>
@ -68,7 +68,7 @@
{% if request.user.is_staff %}
<li><a href="{% url 'admin:index' %}"><i class="fa fa-wrench fa-fw"></i> {% trans 'Admin interface' %}</a></li>
{% endif %}
<li><a href="{% url 'django.contrib.auth.views.logout_then_login' %}"><i class="fa fa-sign-out fa-fw"></i> {% trans 'Log out' %}</a></li>
<li><a href="{% url 'logout' %}"><i class="fa fa-sign-out fa-fw"></i> {% trans 'Log out' %}</a></li>
</ul>
</li>
{% endif %}

View File

@ -3,9 +3,10 @@ top-level url dispatching
"""
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.conf.urls.static import static
def remember_me_login(request, *args, **kw):
@ -20,8 +21,7 @@ def remember_me_login(request, *args, **kw):
return auth_views.login(request, *args, **kw)
urlpatterns = patterns(
'',
urlpatterns = [
url('', include('social_django.urls', namespace='social')),
url(r'^accounts/', include('nsupdate.login.urls')),
# registration and user settings
@ -29,12 +29,9 @@ urlpatterns = patterns(
url(r'^admin/', include(admin.site.urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^', include('nsupdate.main.urls')),
)
]
if settings.DEBUG:
urlpatterns += patterns('django.contrib.staticfiles.views',
url(r'^static/(?P<path>.*)$', 'serve'), )
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
import debug_toolbar
urlpatterns += patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)),
)
urlpatterns += (url(r'^__debug__/', include(debug_toolbar.urls)),)

View File

@ -1,7 +1,7 @@
# packages always needed
dnspython
netaddr
django>=1.8.1, <1.9
django~=1.11.0
django-bootstrap-form
django-registration-redux
django-extensions

View File

@ -19,6 +19,6 @@ sudo chattr +i /etc/resolv.conf
#dig @127.0.0.1 tests.nsupdate.info SOA
#sudo netstat -tulpen | grep 53
pip install Django==$DJANGO
#pip install Django==$DJANGO
pip install -r requirements.d/travis.txt
pip install -e .

View File

@ -12,11 +12,6 @@ from nsupdate import version
with open('README.rst') as f:
readme_content = f.read()
if PY2:
install_requires = ['dnspython', ]
else:
install_requires = ['dnspython3', ]
setup(
name='nsupdate',
version=str(version),
@ -53,9 +48,10 @@ setup(
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=install_requires + [
install_requires=[
'dnspython',
'netaddr',
'django>=1.8.1, <1.9',
'django~=1.11.0',
'django-bootstrap-form',
'django-registration-redux',
'django-extensions',