From f121ffbbab91e529da6bedd2dd52161344a0f17a Mon Sep 17 00:00:00 2001 From: Peter Thomassen Date: Thu, 11 Aug 2022 14:22:12 -0400 Subject: [PATCH] chore(api): bump dependencies Code changes were necessary - in serializers.py (https://docs.djangoproject.com/en/4.1/releases/4.1/#reverse-foreign-key-changes-for-unsaved-model-instances), - in authentication.py (https://docs.djangoproject.com/en/4.1/ref/utils/#django.utils.timezone.utc). --- api/desecapi/authentication.py | 4 ++-- api/desecapi/models.py | 2 +- api/desecapi/serializers.py | 2 +- api/requirements.txt | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/desecapi/authentication.py b/api/desecapi/authentication.py index 5b3f3c692..5e0c7568d 100644 --- a/api/desecapi/authentication.py +++ b/api/desecapi/authentication.py @@ -1,5 +1,5 @@ import base64 -from datetime import datetime, timezone +import datetime from ipaddress import ip_address from django.contrib.auth.hashers import PBKDF2PasswordHasher @@ -161,7 +161,7 @@ def authenticate_credentials(self, context): serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] - email_verified = datetime.fromtimestamp(serializer.timestamp, timezone.utc) + email_verified = datetime.datetime.fromtimestamp(serializer.timestamp, datetime.timezone.utc) user.email_verified = max(user.email_verified or email_verified, email_verified) user.save() diff --git a/api/desecapi/models.py b/api/desecapi/models.py index 3cff5bfbd..d56cacc78 100644 --- a/api/desecapi/models.py +++ b/api/desecapi/models.py @@ -511,7 +511,7 @@ def delete(self): when=pgtrigger.Before, condition=pgtrigger.Q(old__domain__isnull=True, new__domain__isnull=False), ), - # Ideally, this would be a deferred trigger, but depends on https://github.com/Opus10/django-pgtrigger/issues/14 + # Ideally, a deferred trigger (https://github.com/Opus10/django-pgtrigger/issues/14). Available in 3.4.0. pgtrigger.Trigger( name='default_policy_on_delete', operation=pgtrigger.Delete, diff --git a/api/desecapi/serializers.py b/api/desecapi/serializers.py index 15ba06162..cc322b1f1 100644 --- a/api/desecapi/serializers.py +++ b/api/desecapi/serializers.py @@ -531,7 +531,7 @@ def validate(self, attrs): def exists(self, arg): if isinstance(arg, models.RRset): - return arg.records.exists() + return arg.records.exists() if arg.pk else False else: return bool(arg.get('records')) if 'records' in arg.keys() else True diff --git a/api/requirements.txt b/api/requirements.txt index 4c6059132..b76b5ed31 100644 --- a/api/requirements.txt +++ b/api/requirements.txt @@ -2,12 +2,12 @@ captcha~=0.4.0 celery~=5.2.1 coverage~=6.2 cryptography~=37.0.4 -Django~=4.0.3 -django-cors-headers~=3.10.1 +Django~=4.1.0 +django-cors-headers~=3.13.0 djangorestframework~=3.13.1 django-celery-email~=3.0.0 django-netfields~=1.3.0 -django-pgtrigger~=2.4.0 +django-pgtrigger~=2.5.1 # Upgrade to 3.x on occasion. Trigger management syntax has changed considerably. django-prometheus~=2.2.0 dnspython~=2.2.0 httpretty~=1.0.5