mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Remove DecimalValidator import from compat.py
This commit is contained in:
parent
a22b47fb5f
commit
6e007b8c52
|
@ -270,12 +270,6 @@ else:
|
||||||
LONG_SEPARATORS = (b', ', b': ')
|
LONG_SEPARATORS = (b', ', b': ')
|
||||||
INDENT_SEPARATORS = (b',', b': ')
|
INDENT_SEPARATORS = (b',', b': ')
|
||||||
|
|
||||||
# TODO: Remove
|
|
||||||
try:
|
|
||||||
# DecimalValidator is unavailable in Django < 1.9
|
|
||||||
from django.core.validators import DecimalValidator
|
|
||||||
except ImportError:
|
|
||||||
DecimalValidator = None
|
|
||||||
|
|
||||||
class CustomValidatorMessage(object):
|
class CustomValidatorMessage(object):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -8,7 +8,6 @@ from django.core import validators
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
|
|
||||||
from rest_framework.compat import DecimalValidator
|
|
||||||
from rest_framework.validators import UniqueValidator
|
from rest_framework.validators import UniqueValidator
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -187,10 +186,10 @@ def get_field_kwargs(field_name, model_field):
|
||||||
]
|
]
|
||||||
# Our decimal validation is handled in the field code, not validator code.
|
# Our decimal validation is handled in the field code, not validator code.
|
||||||
# (In Django 1.9+ this differs from previous style)
|
# (In Django 1.9+ this differs from previous style)
|
||||||
if isinstance(model_field, models.DecimalField) and DecimalValidator:
|
if isinstance(model_field, models.DecimalField):
|
||||||
validator_kwarg = [
|
validator_kwarg = [
|
||||||
validator for validator in validator_kwarg
|
validator for validator in validator_kwarg
|
||||||
if not isinstance(validator, DecimalValidator)
|
if not isinstance(validator, validators.DecimalValidator)
|
||||||
]
|
]
|
||||||
|
|
||||||
# Ensure that max_length is passed explicitly as a keyword arg,
|
# Ensure that max_length is passed explicitly as a keyword arg,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user