mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-19 04:32:28 +03:00
This commit is contained in:
parent
c11a7e6642
commit
1270ba903a
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.9"
|
python-version: "3.11"
|
||||||
|
|
||||||
- uses: pre-commit/action@v3.0.0
|
- uses: pre-commit/action@v3.0.0
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -9,6 +9,7 @@ import re
|
||||||
import uuid
|
import uuid
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from sys import version_info
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
@ -866,7 +867,9 @@ class IPAddressField(CharField):
|
||||||
self.protocol = protocol.lower()
|
self.protocol = protocol.lower()
|
||||||
self.unpack_ipv4 = (self.protocol == 'both')
|
self.unpack_ipv4 = (self.protocol == 'both')
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
validators, error_message = ip_address_validators(protocol, self.unpack_ipv4)
|
validators = ip_address_validators(protocol, self.unpack_ipv4)
|
||||||
|
if version_info < (3, 12): # encode/django-rest-framework#9180
|
||||||
|
validators = validators[0] # Used to return a tuple: validators, error_message
|
||||||
self.validators.extend(validators)
|
self.validators.extend(validators)
|
||||||
|
|
||||||
def to_internal_value(self, data):
|
def to_internal_value(self, data):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user