mirror of
https://github.com/django/django.git
synced 2024-11-29 22:56:46 +01:00
Fixed #18839 - Field.__init__() now calls super().
This commit is contained in:
parent
0ff12c28d0
commit
aaec4f2bd8
@ -120,6 +120,7 @@ class Field(object):
|
||||
self.error_messages = messages
|
||||
|
||||
self.validators = self.default_validators + validators
|
||||
super(Field, self).__init__()
|
||||
|
||||
def prepare_value(self, value):
|
||||
return value
|
||||
|
@ -163,6 +163,10 @@ Minor features
|
||||
|
||||
* The :djadmin:`diffsettings` comand gained a ``--all`` option.
|
||||
|
||||
* :func:`django.forms.fields.Field.__init__` now calls ``super()``, allowing
|
||||
field mixins to implement ``__init__()`` methods that will reliably be
|
||||
called.
|
||||
|
||||
Backwards incompatible changes in 1.6
|
||||
=====================================
|
||||
|
||||
|
@ -63,6 +63,20 @@ class FieldsTests(SimpleTestCase):
|
||||
self.assertTrue(Field(required=True).widget.is_required)
|
||||
self.assertFalse(Field(required=False).widget.is_required)
|
||||
|
||||
def test_cooperative_multiple_inheritance(self):
|
||||
class A(object):
|
||||
def __init__(self):
|
||||
self.class_a_var = True
|
||||
super(A, self).__init__()
|
||||
|
||||
|
||||
class ComplexField(Field, A):
|
||||
def __init__(self):
|
||||
super(ComplexField, self).__init__()
|
||||
|
||||
f = ComplexField()
|
||||
self.assertTrue(f.class_a_var)
|
||||
|
||||
# CharField ###################################################################
|
||||
|
||||
def test_charfield_1(self):
|
||||
|
Loading…
Reference in New Issue
Block a user