From 0dc67d60a4a067b9c4cc01a3045abc818237b99a Mon Sep 17 00:00:00 2001 From: Florian Eitel Date: Sat, 14 Jan 2023 13:00:12 +0100 Subject: [PATCH] Update to Django 3 --- Pipfile | 2 +- Pipfile.lock | 30 +++++++++++++++++++++++------- src/nsupdate/accounts/models.py | 5 +---- src/nsupdate/main/models.py | 10 +--------- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Pipfile b/Pipfile index ea79353..3a168c9 100644 --- a/Pipfile +++ b/Pipfile @@ -6,7 +6,7 @@ name = "pypi" [packages] dnspython = "*" netaddr = "*" -django = "~=2.2.0" +django = "~=3.0.0" django-bootstrap-form = "*" django-referrer-policy = "*" django-registration-redux = "*" diff --git a/Pipfile.lock b/Pipfile.lock index f2520a4..6846844 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "6189b5cf3ceedd47ba567f9b1afc4285c18909b9964225a13cf108df7482661c" + "sha256": "f4bc97fb900db2e34bb37edc0ed62b30f3696caf657827d0467813a3803a2b45" }, "pipfile-spec": 6, "requires": { @@ -16,6 +16,14 @@ ] }, "default": { + "asgiref": { + "hashes": [ + "sha256:71e68008da809b957b7ee4b43dbccff33d1b23519fb8344e33f049897077afac", + "sha256:9567dfe7bd8d3c8c892227827c41cce860b368104c3431da67a0c5a65a949506" + ], + "markers": "python_version >= '3.7'", + "version": "==3.6.0" + }, "certifi": { "hashes": [ "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3", @@ -225,11 +233,11 @@ }, "django": { "hashes": [ - "sha256:0200b657afbf1bc08003845ddda053c7641b9b24951e52acd51f6abda33a7413", - "sha256:365429d07c1336eb42ba15aa79f45e1c13a0b04d5c21569e7d596696418a6a45" + "sha256:9bc7aa619ed878fedba62ce139abe663a147dccfd20e907725ec11e02a1ca225", + "sha256:d58d8394036db75a81896037d757357e79406e8f68816c3e8a28721c1d9d4c11" ], "index": "pypi", - "version": "==2.2.28" + "version": "==3.0.14" }, "django-bootstrap-form": { "hashes": [ @@ -420,6 +428,14 @@ "markers": "python_version >= '3.6'", "version": "==0.7.13" }, + "asgiref": { + "hashes": [ + "sha256:71e68008da809b957b7ee4b43dbccff33d1b23519fb8344e33f049897077afac", + "sha256:9567dfe7bd8d3c8c892227827c41cce860b368104c3431da67a0c5a65a949506" + ], + "markers": "python_version >= '3.7'", + "version": "==3.6.0" + }, "astroid": { "hashes": [ "sha256:3bc7834720e1a24ca797fd785d77efb14f7a28ee8e635ef040b6e2d80ccb3303", @@ -555,11 +571,11 @@ }, "django": { "hashes": [ - "sha256:0200b657afbf1bc08003845ddda053c7641b9b24951e52acd51f6abda33a7413", - "sha256:365429d07c1336eb42ba15aa79f45e1c13a0b04d5c21569e7d596696418a6a45" + "sha256:9bc7aa619ed878fedba62ce139abe663a147dccfd20e907725ec11e02a1ca225", + "sha256:d58d8394036db75a81896037d757357e79406e8f68816c3e8a28721c1d9d4c11" ], "index": "pypi", - "version": "==2.2.28" + "version": "==3.0.14" }, "django-debug-toolbar": { "hashes": [ diff --git a/src/nsupdate/accounts/models.py b/src/nsupdate/accounts/models.py index 50e35c6..4c29a36 100644 --- a/src/nsupdate/accounts/models.py +++ b/src/nsupdate/accounts/models.py @@ -9,11 +9,8 @@ from django.dispatch import receiver from django.contrib.auth.signals import user_logged_in from django.utils.translation import ugettext_lazy as _ 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): """ stuff we need additionally to what Django stores in User model @@ -25,7 +22,7 @@ class UserProfile(models.Model): verbose_name=_('language')) def __str__(self): - return u"profile for %s" % text_type(self.user) + return u"profile for %s" % str(self.user) class Meta: verbose_name = _('user profile') diff --git a/src/nsupdate/main/models.py b/src/nsupdate/main/models.py index 9a4485d..4092981 100644 --- a/src/nsupdate/main/models.py +++ b/src/nsupdate/main/models.py @@ -18,8 +18,6 @@ from django.db.models.signals import pre_delete, post_save from django.contrib.auth.hashers import make_password from django.utils.timezone import now 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 @@ -34,7 +32,6 @@ def result_fmt(msg): return msg[:RESULT_MSG_LEN] -@python_2_unicode_compatible class BlacklistedHost(models.Model): name_re = models.CharField( _('name RegEx'), @@ -81,7 +78,6 @@ UPDATE_ALGORITHMS = { UPDATE_ALGORITHM_CHOICES = [(k, k) for k in UPDATE_ALGORITHMS] -@python_2_unicode_compatible class Domain(models.Model): name = models.CharField( _("name"), @@ -154,7 +150,6 @@ class Domain(models.Model): ordering = ('name',) -@python_2_unicode_compatible class Host(models.Model): name = models.CharField( _("name"), @@ -373,7 +368,6 @@ def post_save_host(sender, **kwargs): post_save.connect(post_save_host, sender=Host) -@python_2_unicode_compatible class RelatedHost(models.Model): # host addr = network_of_main_host + interface_id name = models.CharField( @@ -414,7 +408,7 @@ class RelatedHost(models.Model): verbose_name=_("main host")) 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): unique_together = (('name', 'main_host'),) @@ -447,7 +441,6 @@ class RelatedHost(models.Model): pre_delete.connect(pre_delete_host, sender=RelatedHost) -@python_2_unicode_compatible class ServiceUpdater(models.Model): name = models.CharField( _("name"), @@ -491,7 +484,6 @@ class ServiceUpdater(models.Model): verbose_name_plural = _('service updaters') -@python_2_unicode_compatible class ServiceUpdaterHostConfig(models.Model): service = models.ForeignKey(ServiceUpdater, on_delete=models.CASCADE, verbose_name=_("service"))