Update to Django 3.0
This commit is contained in:
parent
c85f6ccc36
commit
25e6c828c0
2
Pipfile
2
Pipfile
@ -6,7 +6,7 @@ name = "pypi"
|
|||||||
[packages]
|
[packages]
|
||||||
dnspython = "*"
|
dnspython = "*"
|
||||||
netaddr = "*"
|
netaddr = "*"
|
||||||
django = "~=2.2.0"
|
django = "~=3.0.0"
|
||||||
django-bootstrap-form = "*"
|
django-bootstrap-form = "*"
|
||||||
django-referrer-policy = "*"
|
django-referrer-policy = "*"
|
||||||
django-registration-redux = "*"
|
django-registration-redux = "*"
|
||||||
|
30
Pipfile.lock
generated
30
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "984dd184466999fd5afc4cfff15571e230e37769e0a7f5f1183a6a6fc404bb54"
|
"sha256": "e69d1b89b750a32ddcc3b79ad32e823e55cd3e5d25e7ad1bce4c520803db6ac2"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -16,6 +16,14 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
|
"asgiref": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:71e68008da809b957b7ee4b43dbccff33d1b23519fb8344e33f049897077afac",
|
||||||
|
"sha256:9567dfe7bd8d3c8c892227827c41cce860b368104c3431da67a0c5a65a949506"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.7'",
|
||||||
|
"version": "==3.6.0"
|
||||||
|
},
|
||||||
"certifi": {
|
"certifi": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
|
"sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
|
||||||
@ -225,11 +233,11 @@
|
|||||||
},
|
},
|
||||||
"django": {
|
"django": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0200b657afbf1bc08003845ddda053c7641b9b24951e52acd51f6abda33a7413",
|
"sha256:9bc7aa619ed878fedba62ce139abe663a147dccfd20e907725ec11e02a1ca225",
|
||||||
"sha256:365429d07c1336eb42ba15aa79f45e1c13a0b04d5c21569e7d596696418a6a45"
|
"sha256:d58d8394036db75a81896037d757357e79406e8f68816c3e8a28721c1d9d4c11"
|
||||||
],
|
],
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==2.2.28"
|
"version": "==3.0.14"
|
||||||
},
|
},
|
||||||
"django-bootstrap-form": {
|
"django-bootstrap-form": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
@ -420,6 +428,14 @@
|
|||||||
"markers": "python_version >= '3.6'",
|
"markers": "python_version >= '3.6'",
|
||||||
"version": "==0.7.13"
|
"version": "==0.7.13"
|
||||||
},
|
},
|
||||||
|
"asgiref": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:71e68008da809b957b7ee4b43dbccff33d1b23519fb8344e33f049897077afac",
|
||||||
|
"sha256:9567dfe7bd8d3c8c892227827c41cce860b368104c3431da67a0c5a65a949506"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.7'",
|
||||||
|
"version": "==3.6.0"
|
||||||
|
},
|
||||||
"astroid": {
|
"astroid": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:3bc7834720e1a24ca797fd785d77efb14f7a28ee8e635ef040b6e2d80ccb3303",
|
"sha256:3bc7834720e1a24ca797fd785d77efb14f7a28ee8e635ef040b6e2d80ccb3303",
|
||||||
@ -555,11 +571,11 @@
|
|||||||
},
|
},
|
||||||
"django": {
|
"django": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0200b657afbf1bc08003845ddda053c7641b9b24951e52acd51f6abda33a7413",
|
"sha256:9bc7aa619ed878fedba62ce139abe663a147dccfd20e907725ec11e02a1ca225",
|
||||||
"sha256:365429d07c1336eb42ba15aa79f45e1c13a0b04d5c21569e7d596696418a6a45"
|
"sha256:d58d8394036db75a81896037d757357e79406e8f68816c3e8a28721c1d9d4c11"
|
||||||
],
|
],
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==2.2.28"
|
"version": "==3.0.14"
|
||||||
},
|
},
|
||||||
"django-debug-toolbar": {
|
"django-debug-toolbar": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# packages always needed
|
# packages always needed
|
||||||
dnspython
|
dnspython
|
||||||
netaddr
|
netaddr
|
||||||
django~=2.2.0
|
django~=3.0.0
|
||||||
django-bootstrap-form
|
django-bootstrap-form
|
||||||
django-referrer-policy
|
django-referrer-policy
|
||||||
django-registration-redux
|
django-registration-redux
|
||||||
|
2
setup.py
2
setup.py
@ -31,7 +31,7 @@ setup(
|
|||||||
install_requires=[
|
install_requires=[
|
||||||
'dnspython',
|
'dnspython',
|
||||||
'netaddr',
|
'netaddr',
|
||||||
'django>=2.2.0',
|
'django>=3.0.0',
|
||||||
'django-bootstrap-form',
|
'django-bootstrap-form',
|
||||||
'django-referrer-policy',
|
'django-referrer-policy',
|
||||||
'django-registration-redux',
|
'django-registration-redux',
|
||||||
|
@ -9,11 +9,8 @@ from django.dispatch import receiver
|
|||||||
from django.contrib.auth.signals import user_logged_in
|
from django.contrib.auth.signals import user_logged_in
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import LANGUAGE_SESSION_KEY
|
from django.utils.translation import LANGUAGE_SESSION_KEY
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.six import text_type
|
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class UserProfile(models.Model):
|
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
|
||||||
@ -25,7 +22,7 @@ class UserProfile(models.Model):
|
|||||||
verbose_name=_('language'))
|
verbose_name=_('language'))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return u"profile for %s" % text_type(self.user)
|
return u"profile for %s" % str(self.user)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('user profile')
|
verbose_name = _('user profile')
|
||||||
|
@ -18,8 +18,6 @@ from django.db.models.signals import pre_delete, post_save
|
|||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.six import text_type
|
|
||||||
|
|
||||||
from . import dnstools
|
from . import dnstools
|
||||||
|
|
||||||
@ -34,7 +32,6 @@ def result_fmt(msg):
|
|||||||
return msg[:RESULT_MSG_LEN]
|
return msg[:RESULT_MSG_LEN]
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class BlacklistedHost(models.Model):
|
class BlacklistedHost(models.Model):
|
||||||
name_re = models.CharField(
|
name_re = models.CharField(
|
||||||
_('name RegEx'),
|
_('name RegEx'),
|
||||||
@ -81,7 +78,6 @@ UPDATE_ALGORITHMS = {
|
|||||||
UPDATE_ALGORITHM_CHOICES = [(k, k) for k in UPDATE_ALGORITHMS]
|
UPDATE_ALGORITHM_CHOICES = [(k, k) for k in UPDATE_ALGORITHMS]
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Domain(models.Model):
|
class Domain(models.Model):
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
_("name"),
|
_("name"),
|
||||||
@ -154,7 +150,6 @@ class Domain(models.Model):
|
|||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Host(models.Model):
|
class Host(models.Model):
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
_("name"),
|
_("name"),
|
||||||
@ -373,7 +368,6 @@ def post_save_host(sender, **kwargs):
|
|||||||
post_save.connect(post_save_host, sender=Host)
|
post_save.connect(post_save_host, sender=Host)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class RelatedHost(models.Model):
|
class RelatedHost(models.Model):
|
||||||
# host addr = network_of_main_host + interface_id
|
# host addr = network_of_main_host + interface_id
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
@ -414,7 +408,7 @@ class RelatedHost(models.Model):
|
|||||||
verbose_name=_("main host"))
|
verbose_name=_("main host"))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return u"%s.%s" % (self.name, text_type(self.main_host))
|
return u"%s.%s" % (self.name, str(self.main_host))
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
unique_together = (('name', 'main_host'),)
|
unique_together = (('name', 'main_host'),)
|
||||||
@ -447,7 +441,6 @@ class RelatedHost(models.Model):
|
|||||||
pre_delete.connect(pre_delete_host, sender=RelatedHost)
|
pre_delete.connect(pre_delete_host, sender=RelatedHost)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class ServiceUpdater(models.Model):
|
class ServiceUpdater(models.Model):
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
_("name"),
|
_("name"),
|
||||||
@ -491,7 +484,6 @@ class ServiceUpdater(models.Model):
|
|||||||
verbose_name_plural = _('service updaters')
|
verbose_name_plural = _('service updaters')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class ServiceUpdaterHostConfig(models.Model):
|
class ServiceUpdaterHostConfig(models.Model):
|
||||||
service = models.ForeignKey(ServiceUpdater, on_delete=models.CASCADE, verbose_name=_("service"))
|
service = models.ForeignKey(ServiceUpdater, on_delete=models.CASCADE, verbose_name=_("service"))
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ top-level url dispatching
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import login
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.views.generic import RedirectView
|
from django.views.generic import RedirectView
|
||||||
@ -20,7 +20,7 @@ def remember_me_login(request, *args, **kw):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if request.POST.get('remember_me'):
|
if request.POST.get('remember_me'):
|
||||||
request.session.set_expiry(settings.SESSION_COOKIE_AGE)
|
request.session.set_expiry(settings.SESSION_COOKIE_AGE)
|
||||||
return auth_views.login(request, *args, **kw)
|
return login(request, *args, **kw)
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user