|
14 | 14 | from django.core.exceptions import ValidationError as DjangoValidationError
|
15 | 15 | from django.core.validators import (
|
16 | 16 | EmailValidator, MaxLengthValidator, MaxValueValidator, MinLengthValidator,
|
17 |
| - MinValueValidator, RegexValidator, URLValidator, ip_address_validators |
| 17 | + MinValueValidator, ProhibitNullCharactersValidator, RegexValidator, |
| 18 | + URLValidator, ip_address_validators |
18 | 19 | )
|
19 | 20 | from django.forms import FilePathField as DjangoFilePathField
|
20 | 21 | from django.forms import ImageField as DjangoImageField
|
|
33 | 34 | from rest_framework import (
|
34 | 35 | ISO_8601, RemovedInDRF313Warning, RemovedInDRF314Warning
|
35 | 36 | )
|
36 |
| -from rest_framework.compat import ProhibitNullCharactersValidator |
37 | 37 | from rest_framework.exceptions import ErrorDetail, ValidationError
|
38 | 38 | from rest_framework.settings import api_settings
|
39 | 39 | from rest_framework.utils import html, humanize_datetime, json, representation
|
@@ -785,9 +785,7 @@ def __init__(self, **kwargs):
|
785 | 785 | self.validators.append(
|
786 | 786 | MinLengthValidator(self.min_length, message=message))
|
787 | 787 |
|
788 |
| - # ProhibitNullCharactersValidator is None on Django < 2.0 |
789 |
| - if ProhibitNullCharactersValidator is not None: |
790 |
| - self.validators.append(ProhibitNullCharactersValidator()) |
| 788 | + self.validators.append(ProhibitNullCharactersValidator()) |
791 | 789 | self.validators.append(ProhibitSurrogateCharactersValidator())
|
792 | 790 |
|
793 | 791 | def run_validation(self, data=empty):
|
|
0 commit comments