From cbf702728730c94e670b8ad4b652d0c7f49408e0 Mon Sep 17 00:00:00 2001 From: Fabian Weisshaar Date: Thu, 28 Dec 2017 17:12:34 +0100 Subject: [PATCH] already something for Django 2.0 --- nsupdate/accounts/_tests/test_accounts.py | 2 +- nsupdate/accounts/models.py | 2 +- nsupdate/accounts/views.py | 2 +- nsupdate/api/_tests/test_api.py | 2 +- nsupdate/main/_tests/test_main.py | 2 +- nsupdate/main/models.py | 10 +++++----- nsupdate/main/views.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nsupdate/accounts/_tests/test_accounts.py b/nsupdate/accounts/_tests/test_accounts.py index e585bf3..8d7bb32 100644 --- a/nsupdate/accounts/_tests/test_accounts.py +++ b/nsupdate/accounts/_tests/test_accounts.py @@ -6,7 +6,7 @@ from __future__ import print_function import pytest -from django.core.urlresolvers import reverse +from django.urls import reverse USERNAME = 'test' diff --git a/nsupdate/accounts/models.py b/nsupdate/accounts/models.py index 8da8e06..50e35c6 100644 --- a/nsupdate/accounts/models.py +++ b/nsupdate/accounts/models.py @@ -19,7 +19,7 @@ class UserProfile(models.Model): stuff we need additionally to what Django stores in User model """ user = models.OneToOneField(settings.AUTH_USER_MODEL, primary_key=True, related_name='profile', - verbose_name=_('user')) + verbose_name=_('user'), on_delete=models.CASCADE) language = models.CharField(max_length=10, choices=settings.LANGUAGES, default='', blank=True, null=True, verbose_name=_('language')) diff --git a/nsupdate/accounts/views.py b/nsupdate/accounts/views.py index 4ccbcb2..a02da32 100644 --- a/nsupdate/accounts/views.py +++ b/nsupdate/accounts/views.py @@ -7,7 +7,7 @@ from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_protect from django.views.decorators.debug import sensitive_post_parameters -from django.core.urlresolvers import reverse, reverse_lazy +from django.urls import reverse, reverse_lazy from django.shortcuts import redirect from django.contrib import messages from django.utils.translation import ugettext_lazy as _ diff --git a/nsupdate/api/_tests/test_api.py b/nsupdate/api/_tests/test_api.py index 3d514ac..f6e072b 100644 --- a/nsupdate/api/_tests/test_api.py +++ b/nsupdate/api/_tests/test_api.py @@ -7,7 +7,7 @@ import pytest import base64 from netaddr import IPSet, IPAddress, IPNetwork -from django.core.urlresolvers import reverse +from django.urls import reverse from nsupdate.main.dnstools import query_ns, FQDN from nsupdate.main.models import Domain diff --git a/nsupdate/main/_tests/test_main.py b/nsupdate/main/_tests/test_main.py index d887104..ccb88d0 100644 --- a/nsupdate/main/_tests/test_main.py +++ b/nsupdate/main/_tests/test_main.py @@ -6,7 +6,7 @@ from __future__ import print_function import pytest -from django.core.urlresolvers import reverse +from django.urls import reverse USERNAME = 'test' diff --git a/nsupdate/main/models.py b/nsupdate/main/models.py index 57930c7..c436fb6 100644 --- a/nsupdate/main/models.py +++ b/nsupdate/main/models.py @@ -47,7 +47,7 @@ class BlacklistedHost(models.Model): created_by = models.ForeignKey( settings.AUTH_USER_MODEL, related_name='blacklisted_domains', - verbose_name=_('created by')) + verbose_name=_('created by'), on_delete=models.CASCADE) def __str__(self): return self.name_re @@ -128,7 +128,7 @@ class Domain(models.Model): last_update = models.DateTimeField(_("last update"), auto_now=True) created = models.DateTimeField(_("created at"), auto_now_add=True) - created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='domains', verbose_name=_("created by")) + created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='domains', verbose_name=_("created by"), on_delete=models.CASCADE) def __str__(self): return self.name @@ -249,7 +249,7 @@ class Host(models.Model): last_update = models.DateTimeField(_("last update"), auto_now=True) created = models.DateTimeField(_("created at"), auto_now_add=True) - created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='hosts', verbose_name=_("created by"),) + created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='hosts', verbose_name=_("created by"), on_delete=models.CASCADE) def __str__(self): return u"%s.%s" % (self.name, self.domain.name) @@ -475,7 +475,7 @@ class ServiceUpdater(models.Model): created_by = models.ForeignKey( settings.AUTH_USER_MODEL, related_name='serviceupdater', - verbose_name=_("created by")) + verbose_name=_("created by"), on_delete=models.CASCADE) def __str__(self): return self.name @@ -525,7 +525,7 @@ class ServiceUpdaterHostConfig(models.Model): created_by = models.ForeignKey( settings.AUTH_USER_MODEL, related_name='serviceupdaterhostconfigs', - verbose_name=_("created by")) + verbose_name=_("created by"), on_delete=models.CASCADE) def __str__(self): return u"%s (%s)" % (self.hostname, self.service.name, ) diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py index 3a504b8..0714b75 100644 --- a/nsupdate/main/views.py +++ b/nsupdate/main/views.py @@ -16,7 +16,7 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth import get_user_model from django.contrib import messages from django.utils.decorators import method_decorator -from django.core.urlresolvers import reverse +from django.urls import reverse from django.http import Http404 from django import template from django.utils.timezone import now