mirror of
https://github.com/django/django.git
synced 2024-11-29 22:56:46 +01:00
Refs #23162 -- Removed forms.Field._has_changed() method.
Per deprecation timeline.
This commit is contained in:
parent
491de4f07c
commit
a3fe4addcb
@ -28,9 +28,6 @@ from django.forms.widgets import (
|
||||
)
|
||||
from django.utils import formats, six
|
||||
from django.utils.dateparse import parse_duration
|
||||
from django.utils.deprecation import (
|
||||
RemovedInDjango110Warning, RenameMethodsBase,
|
||||
)
|
||||
from django.utils.duration import duration_string
|
||||
from django.utils.encoding import force_str, force_text, smart_text
|
||||
from django.utils.ipv6 import clean_ipv6_address
|
||||
@ -48,13 +45,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class RenameFieldMethods(RenameMethodsBase):
|
||||
renamed_methods = (
|
||||
('_has_changed', 'has_changed', RemovedInDjango110Warning),
|
||||
)
|
||||
|
||||
|
||||
class Field(six.with_metaclass(RenameFieldMethods, object)):
|
||||
class Field(object):
|
||||
widget = TextInput # Default widget to use when rendering this type of Field.
|
||||
hidden_widget = HiddenInput # Default widget to use when rendering this as "hidden".
|
||||
default_validators = [] # Default set of validators
|
||||
|
@ -44,10 +44,9 @@ from django.forms import (
|
||||
Textarea, TextInput, TimeField, TypedChoiceField, TypedMultipleChoiceField,
|
||||
URLField, UUIDField, ValidationError, Widget, forms,
|
||||
)
|
||||
from django.test import SimpleTestCase, ignore_warnings
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils import formats, six, translation
|
||||
from django.utils._os import upath
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.duration import duration_string
|
||||
|
||||
try:
|
||||
@ -568,14 +567,11 @@ class FieldsTests(SimpleTestCase):
|
||||
f = DateField()
|
||||
self.assertRaisesMessage(ValidationError, "'Enter a valid date.'", f.clean, 'a\x00b')
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango110Warning) # for _has_changed
|
||||
def test_datefield_changed(self):
|
||||
format = '%d/%m/%Y'
|
||||
f = DateField(input_formats=[format])
|
||||
d = datetime.date(2007, 9, 17)
|
||||
self.assertFalse(f.has_changed(d, '17/09/2007'))
|
||||
# Test for deprecated behavior _has_changed
|
||||
self.assertFalse(f._has_changed(d, '17/09/2007'))
|
||||
|
||||
def test_datefield_strptime(self):
|
||||
"""Test that field.strptime doesn't raise an UnicodeEncodeError (#16123)"""
|
||||
|
Loading…
Reference in New Issue
Block a user