mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Confirmed support for Django 4.1. (#8498)
This commit is contained in:
		
							parent
							
								
									7069083b0f
								
							
						
					
					
						commit
						333f1ffb94
					
				| 
						 | 
				
			
			@ -55,7 +55,7 @@ There is a live example API for testing purposes, [available here][sandbox].
 | 
			
		|||
# Requirements
 | 
			
		||||
 | 
			
		||||
* Python (3.6, 3.7, 3.8, 3.9, 3.10)
 | 
			
		||||
* Django (2.2, 3.0, 3.1, 3.2, 4.0)
 | 
			
		||||
* Django (2.2, 3.0, 3.1, 3.2, 4.0, 4.1)
 | 
			
		||||
 | 
			
		||||
We **highly recommend** and only officially support the latest patch release of
 | 
			
		||||
each Python and Django series.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,7 +86,7 @@ continued development by **[signing up for a paid plan][funding]**.
 | 
			
		|||
REST framework requires the following:
 | 
			
		||||
 | 
			
		||||
* Python (3.6, 3.7, 3.8, 3.9, 3.10)
 | 
			
		||||
* Django (2.2, 3.0, 3.1, 3.2, 4.0)
 | 
			
		||||
* Django (2.2, 3.0, 3.1, 3.2, 4.0, 4.1)
 | 
			
		||||
 | 
			
		||||
We **highly recommend** and only officially support the latest patch release of
 | 
			
		||||
each Python and Django series.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,6 @@ from django.utils.duration import duration_string
 | 
			
		|||
from django.utils.encoding import is_protected_type, smart_str
 | 
			
		||||
from django.utils.formats import localize_input, sanitize_separators
 | 
			
		||||
from django.utils.ipv6 import clean_ipv6_address
 | 
			
		||||
from django.utils.timezone import utc
 | 
			
		||||
from django.utils.translation import gettext_lazy as _
 | 
			
		||||
from pytz.exceptions import InvalidTimeError
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1190,7 +1189,7 @@ class DateTimeField(Field):
 | 
			
		|||
            except InvalidTimeError:
 | 
			
		||||
                self.fail('make_aware', timezone=field_timezone)
 | 
			
		||||
        elif (field_timezone is None) and timezone.is_aware(value):
 | 
			
		||||
            return timezone.make_naive(value, utc)
 | 
			
		||||
            return timezone.make_naive(value, datetime.timezone.utc)
 | 
			
		||||
        return value
 | 
			
		||||
 | 
			
		||||
    def default_timezone(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								setup.py
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -94,6 +94,7 @@ setup(
 | 
			
		|||
        'Framework :: Django :: 3.1',
 | 
			
		||||
        'Framework :: Django :: 3.2',
 | 
			
		||||
        'Framework :: Django :: 4.0',
 | 
			
		||||
        'Framework :: Django :: 4.1',
 | 
			
		||||
        'Intended Audience :: Developers',
 | 
			
		||||
        'License :: OSI Approved :: BSD License',
 | 
			
		||||
        'Operating System :: OS Independent',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,15 +1,16 @@
 | 
			
		|||
from datetime import date, datetime, timedelta
 | 
			
		||||
from datetime import date, datetime, timedelta, timezone
 | 
			
		||||
from decimal import Decimal
 | 
			
		||||
from uuid import uuid4
 | 
			
		||||
 | 
			
		||||
import pytest
 | 
			
		||||
from django.test import TestCase
 | 
			
		||||
from django.utils.timezone import utc
 | 
			
		||||
 | 
			
		||||
from rest_framework.compat import coreapi
 | 
			
		||||
from rest_framework.utils.encoders import JSONEncoder
 | 
			
		||||
from rest_framework.utils.serializer_helpers import ReturnList
 | 
			
		||||
 | 
			
		||||
utc = timezone.utc
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MockList:
 | 
			
		||||
    def tolist(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import pytz
 | 
			
		|||
from django.core.exceptions import ValidationError as DjangoValidationError
 | 
			
		||||
from django.http import QueryDict
 | 
			
		||||
from django.test import TestCase, override_settings
 | 
			
		||||
from django.utils.timezone import activate, deactivate, override, utc
 | 
			
		||||
from django.utils.timezone import activate, deactivate, override
 | 
			
		||||
 | 
			
		||||
import rest_framework
 | 
			
		||||
from rest_framework import exceptions, serializers
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +17,8 @@ from rest_framework.fields import (
 | 
			
		|||
    BuiltinSignatureError, DjangoImageField, is_simple_callable
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
utc = datetime.timezone.utc
 | 
			
		||||
 | 
			
		||||
# Tests for helper functions.
 | 
			
		||||
# ---------------------------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@ import sys
 | 
			
		|||
import tempfile
 | 
			
		||||
from collections import OrderedDict
 | 
			
		||||
 | 
			
		||||
import django
 | 
			
		||||
import pytest
 | 
			
		||||
from django.core.exceptions import ImproperlyConfigured
 | 
			
		||||
from django.core.serializers.json import DjangoJSONEncoder
 | 
			
		||||
| 
						 | 
				
			
			@ -452,11 +453,14 @@ class TestPosgresFieldsMapping(TestCase):
 | 
			
		|||
                model = ArrayFieldModel
 | 
			
		||||
                fields = ['array_field', 'array_field_with_blank']
 | 
			
		||||
 | 
			
		||||
        validators = ""
 | 
			
		||||
        if django.VERSION < (4, 1):
 | 
			
		||||
            validators = ", validators=[<django.core.validators.MaxLengthValidator object>]"
 | 
			
		||||
        expected = dedent("""
 | 
			
		||||
            TestSerializer():
 | 
			
		||||
                array_field = ListField(allow_empty=False, child=CharField(label='Array field', validators=[<django.core.validators.MaxLengthValidator object>]))
 | 
			
		||||
                array_field_with_blank = ListField(child=CharField(label='Array field with blank', validators=[<django.core.validators.MaxLengthValidator object>]), required=False)
 | 
			
		||||
        """)
 | 
			
		||||
                array_field = ListField(allow_empty=False, child=CharField(label='Array field'%s))
 | 
			
		||||
                array_field_with_blank = ListField(child=CharField(label='Array field with blank'%s), required=False)
 | 
			
		||||
        """ % (validators, validators))
 | 
			
		||||
        self.assertEqual(repr(TestSerializer()), expected)
 | 
			
		||||
 | 
			
		||||
    @pytest.mark.skipif(hasattr(models, 'JSONField'), reason='has models.JSONField')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								tox.ini
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -3,7 +3,7 @@ envlist =
 | 
			
		|||
       {py36,py37,py38,py39}-django22,
 | 
			
		||||
       {py36,py37,py38,py39}-django31,
 | 
			
		||||
       {py36,py37,py38,py39,py310}-django32,
 | 
			
		||||
       {py38,py39,py310}-{django40,djangomain},
 | 
			
		||||
       {py38,py39,py310}-{django40,django41,djangomain},
 | 
			
		||||
       base,dist,docs,
 | 
			
		||||
 | 
			
		||||
[travis:env]
 | 
			
		||||
| 
						 | 
				
			
			@ -12,6 +12,7 @@ DJANGO =
 | 
			
		|||
    3.1: django31
 | 
			
		||||
    3.2: django32
 | 
			
		||||
    4.0: django40
 | 
			
		||||
    4.1: django41
 | 
			
		||||
    main: djangomain
 | 
			
		||||
 | 
			
		||||
[testenv]
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +25,8 @@ deps =
 | 
			
		|||
        django22: Django>=2.2,<3.0
 | 
			
		||||
        django31: Django>=3.1,<3.2
 | 
			
		||||
        django32: Django>=3.2,<4.0
 | 
			
		||||
        django40: Django>=4.0,<5.0
 | 
			
		||||
        django40: Django>=4.0,<4.1
 | 
			
		||||
        django41: Django>=4.1a1,<4.2
 | 
			
		||||
        djangomain: https://github.com/django/django/archive/main.tar.gz
 | 
			
		||||
        -rrequirements/requirements-testing.txt
 | 
			
		||||
        -rrequirements/requirements-optionals.txt
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user