Skip to content

Commit 8f03aea

Browse files
committed
add support for the new step value validator in django 4.1
1 parent fa60d9c commit 8f03aea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drf_standardized_errors/openapi_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from dataclasses import field as dataclass_field
33
from typing import List, Optional, Set, Type, Union
44

5+
import django
56
from django import forms
67
from django.core.validators import (
78
DecimalValidator,
@@ -372,6 +373,11 @@ def get_error_codes_from_validators(
372373
EmailValidator,
373374
FileExtensionValidator,
374375
]
376+
if django.VERSION >= (4, 1):
377+
from django.core.validators import StepValueValidator
378+
379+
validators.append(StepValueValidator)
380+
375381
for validator in validators:
376382
if has_validator(field, validator):
377383
error_codes.add(validator.code)

0 commit comments

Comments
 (0)