already something for Django 2.0

This commit is contained in:
Fabian Weisshaar 2017-12-28 17:12:34 +01:00 committed by Fabian Weisshaar
parent 55f47ff52d
commit cbf7027287
7 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@ from __future__ import print_function
import pytest import pytest
from django.core.urlresolvers import reverse from django.urls import reverse
USERNAME = 'test' USERNAME = 'test'

View File

@ -19,7 +19,7 @@ class UserProfile(models.Model):
stuff we need additionally to what Django stores in User 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', 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, language = models.CharField(max_length=10, choices=settings.LANGUAGES,
default='', blank=True, null=True, default='', blank=True, null=True,
verbose_name=_('language')) verbose_name=_('language'))

View File

@ -7,7 +7,7 @@ from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_protect from django.views.decorators.csrf import csrf_protect
from django.views.decorators.debug import sensitive_post_parameters 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.shortcuts import redirect
from django.contrib import messages from django.contrib import messages
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _

View File

@ -7,7 +7,7 @@ import pytest
import base64 import base64
from netaddr import IPSet, IPAddress, IPNetwork 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.dnstools import query_ns, FQDN
from nsupdate.main.models import Domain from nsupdate.main.models import Domain

View File

@ -6,7 +6,7 @@ from __future__ import print_function
import pytest import pytest
from django.core.urlresolvers import reverse from django.urls import reverse
USERNAME = 'test' USERNAME = 'test'

View File

@ -47,7 +47,7 @@ class BlacklistedHost(models.Model):
created_by = models.ForeignKey( created_by = models.ForeignKey(
settings.AUTH_USER_MODEL, settings.AUTH_USER_MODEL,
related_name='blacklisted_domains', related_name='blacklisted_domains',
verbose_name=_('created by')) verbose_name=_('created by'), on_delete=models.CASCADE)
def __str__(self): def __str__(self):
return self.name_re return self.name_re
@ -128,7 +128,7 @@ class Domain(models.Model):
last_update = models.DateTimeField(_("last update"), auto_now=True) last_update = models.DateTimeField(_("last update"), auto_now=True)
created = models.DateTimeField(_("created at"), auto_now_add=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): def __str__(self):
return self.name return self.name
@ -249,7 +249,7 @@ class Host(models.Model):
last_update = models.DateTimeField(_("last update"), auto_now=True) last_update = models.DateTimeField(_("last update"), auto_now=True)
created = models.DateTimeField(_("created at"), auto_now_add=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): def __str__(self):
return u"%s.%s" % (self.name, self.domain.name) return u"%s.%s" % (self.name, self.domain.name)
@ -475,7 +475,7 @@ class ServiceUpdater(models.Model):
created_by = models.ForeignKey( created_by = models.ForeignKey(
settings.AUTH_USER_MODEL, settings.AUTH_USER_MODEL,
related_name='serviceupdater', related_name='serviceupdater',
verbose_name=_("created by")) verbose_name=_("created by"), on_delete=models.CASCADE)
def __str__(self): def __str__(self):
return self.name return self.name
@ -525,7 +525,7 @@ class ServiceUpdaterHostConfig(models.Model):
created_by = models.ForeignKey( created_by = models.ForeignKey(
settings.AUTH_USER_MODEL, settings.AUTH_USER_MODEL,
related_name='serviceupdaterhostconfigs', related_name='serviceupdaterhostconfigs',
verbose_name=_("created by")) verbose_name=_("created by"), on_delete=models.CASCADE)
def __str__(self): def __str__(self):
return u"%s (%s)" % (self.hostname, self.service.name, ) return u"%s (%s)" % (self.hostname, self.service.name, )

View File

@ -16,7 +16,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib import messages from django.contrib import messages
from django.utils.decorators import method_decorator 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.http import Http404
from django import template from django import template
from django.utils.timezone import now from django.utils.timezone import now