Skip to content

Commit f711c83

Browse files
authored
Merge pull request ietf-tools#5740 from ietf-tools/feat/django4
feat!: django4
2 parents e3d16bc + 5d467d9 commit f711c83

123 files changed

Lines changed: 748 additions & 552 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ jobs:
9191
echo "pkg_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
9292
echo "::notice::Release $NEXT_VERSION created using branch $GITHUB_REF_NAME"
9393
else
94-
echo "Using TEST mode: 10.0.0-dev.$GITHUB_RUN_NUMBER"
94+
echo "Using TEST mode: 11.0.0-dev.$GITHUB_RUN_NUMBER"
9595
echo "should_deploy=false" >> $GITHUB_OUTPUT
96-
echo "pkg_version=10.0.0-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT
97-
echo "::notice::Non-production build 10.0.0-dev.$GITHUB_RUN_NUMBER created using branch $GITHUB_REF_NAME"
96+
echo "pkg_version=11.0.0-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT
97+
echo "::notice::Non-production build 11.0.0-dev.$GITHUB_RUN_NUMBER created using branch $GITHUB_REF_NAME"
9898
fi
9999
100100
# -----------------------------------------------------------------

.github/workflows/ci-run-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
branches:
66
- 'main'
7+
- 'feat/django4'
78
paths:
89
- 'client/**'
910
- 'ietf/**'

dev/deploy-to-container/settings_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'HOST': '__DBHOST__',
1111
'PORT': 5432,
1212
'NAME': 'datatracker',
13-
'ENGINE': 'django.db.backends.postgresql_psycopg2',
13+
'ENGINE': 'django.db.backends.postgresql',
1414
'USER': 'django',
1515
'PASSWORD': 'RkTkDPFnKpko',
1616
},

dev/diff/settings_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'HOST': '__DBHOST__',
1111
'PORT': 5432,
1212
'NAME': 'datatracker',
13-
'ENGINE': 'django.db.backends.postgresql_psycopg2',
13+
'ENGINE': 'django.db.backends.postgresql',
1414
'USER': 'django',
1515
'PASSWORD': 'RkTkDPFnKpko',
1616
},

dev/tests/settings_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'HOST': 'db',
1111
'PORT': 5432,
1212
'NAME': 'datatracker',
13-
'ENGINE': 'django.db.backends.postgresql_psycopg2',
13+
'ENGINE': 'django.db.backends.postgresql',
1414
'USER': 'django',
1515
'PASSWORD': 'RkTkDPFnKpko',
1616
},

docker/configs/settings_postgresqldb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'HOST': 'db',
44
'PORT': 5432,
55
'NAME': 'datatracker',
6-
'ENGINE': 'django.db.backends.postgresql_psycopg2',
6+
'ENGINE': 'django.db.backends.postgresql',
77
'USER': 'django',
88
'PASSWORD': 'RkTkDPFnKpko',
99
},

ietf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Version must stay in single quotes for automatic CI replace
88
# Don't add patch number here:
9-
__version__ = '10.0.0-dev'
9+
__version__ = '11.0.0-dev'
1010

1111
# Release hash must stay in single quotes for automatic CI replace
1212
__release_hash__ = ''

ietf/api/serializer.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
from django.core.exceptions import ObjectDoesNotExist, FieldError
1010
from django.core.serializers.json import Serializer
1111
from django.http import HttpResponse
12-
from django.utils.encoding import smart_text
12+
from django.utils.encoding import smart_str
1313
from django.db.models import Field
14-
from django.db.models.query import QuerySet
1514
from django.db.models.signals import post_save, post_delete, m2m_changed
1615

16+
from django_stubs_ext import QuerySetAny
17+
1718
import debug # pyflakes:ignore
1819

1920

@@ -121,7 +122,7 @@ def end_object(self, obj):
121122
for name in expansions:
122123
try:
123124
field = getattr(obj, name)
124-
#self._current["_"+name] = smart_text(field)
125+
#self._current["_"+name] = smart_str(field)
125126
if not isinstance(field, Field):
126127
options = self.options.copy()
127128
options["expand"] = [ v[len(name)+2:] for v in options["expand"] if v.startswith(name+"__") ]
@@ -145,7 +146,7 @@ def end_object(self, obj):
145146
field_value = None
146147
else:
147148
field_value = field
148-
if isinstance(field_value, QuerySet) or isinstance(field_value, list):
149+
if isinstance(field_value, QuerySetAny) or isinstance(field_value, list):
149150
self._current[name] = dict([ (rel.pk, self.expand_related(rel, name)) for rel in field_value ])
150151
else:
151152
if hasattr(field_value, "_meta"):
@@ -188,10 +189,10 @@ def handle_fk_field(self, obj, field):
188189
related = related.natural_key()
189190
elif field.remote_field.field_name == related._meta.pk.name:
190191
# Related to remote object via primary key
191-
related = smart_text(related._get_pk_val(), strings_only=True)
192+
related = smart_str(related._get_pk_val(), strings_only=True)
192193
else:
193194
# Related to remote object via other field
194-
related = smart_text(getattr(related, field.remote_field.field_name), strings_only=True)
195+
related = smart_str(getattr(related, field.remote_field.field_name), strings_only=True)
195196
self._current[field.name] = related
196197

197198
def handle_m2m_field(self, obj, field):
@@ -201,7 +202,7 @@ def handle_m2m_field(self, obj, field):
201202
elif self.use_natural_keys and hasattr(field.remote_field.to, 'natural_key'):
202203
m2m_value = lambda value: value.natural_key()
203204
else:
204-
m2m_value = lambda value: smart_text(value._get_pk_val(), strings_only=True)
205+
m2m_value = lambda value: smart_str(value._get_pk_val(), strings_only=True)
205206
self._current[field.name] = [m2m_value(related)
206207
for related in getattr(obj, field.name).iterator()]
207208

@@ -221,7 +222,7 @@ class JsonExportMixin(object):
221222
# obj = None
222223
#
223224
# if obj is None:
224-
# raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_text(self.model._meta.verbose_name), 'key': escape(object_id)})
225+
# raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_str(self.model._meta.verbose_name), 'key': escape(object_id)})
225226
#
226227
# content_type = 'application/json'
227228
# return HttpResponse(serialize([ obj ], sort_keys=True, indent=3)[2:-2], content_type=content_type)
@@ -264,6 +265,6 @@ def json_view(self, request, filter=None, expand=None):
264265
qd = dict( ( k, json.loads(v)[0] ) for k,v in items )
265266
except (FieldError, ValueError) as e:
266267
return HttpResponse(json.dumps({"error": str(e)}, sort_keys=True, indent=3), content_type=content_type)
267-
text = json.dumps({smart_text(self.model._meta): qd}, sort_keys=True, indent=3)
268+
text = json.dumps({smart_str(self.model._meta): qd}, sort_keys=True, indent=3)
268269
return HttpResponse(text, content_type=content_type)
269270

ietf/api/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def test_api_new_meeting_registration(self):
691691
self.assertEqual(set(missing_fields), set(drop_fields))
692692

693693
def test_api_version(self):
694-
DumpInfo.objects.create(date=timezone.datetime(2022,8,31,7,10,1,tzinfo=timezone.utc), host='testapi.example.com',tz='UTC')
694+
DumpInfo.objects.create(date=timezone.datetime(2022,8,31,7,10,1,tzinfo=datetime.timezone.utc), host='testapi.example.com',tz='UTC')
695695
url = urlreverse('ietf.api.views.version')
696696
r = self.client.get(url)
697697
data = r.json()

ietf/api/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright The IETF Trust 2017, All Rights Reserved
22

33
from django.conf import settings
4-
from django.conf.urls import include
4+
from django.urls import include
55
from django.views.generic import TemplateView
66

77
from ietf import api

0 commit comments

Comments
 (0)