Skip to content

Commit 205f898

Browse files
authored
Merge pull request #1381 from tfranzel/py313
Django 5.2 and python 3.13 minor changes
2 parents c122d6a + cb5ff5a commit 205f898

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Requirements
6262
------------
6363

6464
- Python >= 3.7
65-
- Django (2.2, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1)
65+
- Django (2.2, 3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2)
6666
- Django REST Framework (3.10.3, 3.11, 3.12, 3.13, 3.14, 3.15)
6767

6868
Installation

drf_spectacular/openapi.py

+6
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,12 @@ def _map_serializer_field(self, field, direction, bypass_extensions=False):
912912
# the only way to detect an uninitialized partial method
913913
# this is a convenience method for model choice fields and is mostly a string
914914
schema = build_basic_type(str)
915+
elif (
916+
hasattr(target, "__partialmethod__")
917+
and target.__partialmethod__.func.__name__ == '_get_FIELD_display'
918+
):
919+
# same as above but specifically for python >= 3.13
920+
schema = build_basic_type(str)
915921
elif callable(target):
916922
schema = self._map_response_type_hint(target)
917923
elif isinstance(target, models.Field):

drf_spectacular/plumbing.py

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ def post_cleanup(doc: str) -> str:
236236
# also clean up trailing whitespace for each line
237237
return '\n'.join(line.rstrip() for line in doc.rstrip().split('\n'))
238238

239+
if obj is None:
240+
return ''
239241
if not inspect.isclass(obj):
240242
return post_cleanup(inspect.getdoc(obj) or '')
241243

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def get_version(package):
8888
'Framework :: Django :: 4.2',
8989
'Framework :: Django :: 5.0',
9090
'Framework :: Django :: 5.1',
91+
'Framework :: Django :: 5.2',
9192
'Intended Audience :: Developers',
9293
'License :: OSI Approved :: BSD License',
9394
'Operating System :: OS Independent',
@@ -100,6 +101,7 @@ def get_version(package):
100101
'Programming Language :: Python :: 3.10',
101102
'Programming Language :: Python :: 3.11',
102103
'Programming Language :: Python :: 3.12',
104+
'Programming Language :: Python :: 3.13',
103105
'Topic :: Internet :: WWW/HTTP',
104106
'Topic :: Documentation',
105107
'Topic :: Software Development :: Code Generators',

tox.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ envlist =
66
{py38,py39,py310}-django{4.0,4.1}-drf{3.13,3.14},
77
{py311}-django{4.1, 4.2, 5.0}-drf{3.14},
88
{py312}-django{4.2, 5.0}-drf{3.14},
9-
{py312}-django{5.1}-drf{3.15},
9+
{py312,py313}-django{5.1,5.2}-drf{3.15},
1010
py312-django5.1-drfmaster,
1111
py312-djangomaster-drf3.15,
1212
py312-drfmaster-djangomaster
@@ -27,6 +27,7 @@ deps =
2727
django4.2: Django>=4.2,<4.3
2828
django5.0: Django>=5.0,<5.1
2929
django5.1: Django>=5.1,<5.2
30+
django5.2: Django>=5.1,<5.3
3031

3132
drf3.10: djangorestframework>=3.10,<3.11
3233
drf3.11: djangorestframework>=3.11,<3.12

0 commit comments

Comments
 (0)