From a3fe4addcb9063fc327c8609c7ebba4d531da4ce Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 3 Sep 2015 14:47:40 -0400 Subject: [PATCH] Refs #23162 -- Removed forms.Field._has_changed() method. Per deprecation timeline. --- django/forms/fields.py | 11 +---------- tests/forms_tests/tests/test_fields.py | 6 +----- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/django/forms/fields.py b/django/forms/fields.py index 66ff1de7fa..55f225e65b 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -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 diff --git a/tests/forms_tests/tests/test_fields.py b/tests/forms_tests/tests/test_fields.py index a2caf7ea0c..42e7bc91f7 100644 --- a/tests/forms_tests/tests/test_fields.py +++ b/tests/forms_tests/tests/test_fields.py @@ -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)"""