Code

Ticket #4239: forms.diff

File forms.diff, 832 bytes (added by ctdecci@…, 7 years ago)
Line 
1Index: django/newforms/forms.py
2===================================================================
3--- django/newforms/forms.py    (revision 5148)
4+++ django/newforms/forms.py    (working copy)
5@@ -37,8 +37,10 @@
6     'base_fields', taking into account parent class 'base_fields' as well.
7     """
8     def __new__(cls, name, bases, attrs):
9-        fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)]
10-        fields.sort(lambda x, y: cmp(x[1].creation_counter, y[1].creation_counter))
11+        if attrs.has_key('base_fields'):
12+            fields = attrs['base_fields'].items()
13+        else:
14+            fields = []
15 
16         # If this class is subclassing another Form, add that Form's fields.
17         # Note that we loop over the bases in *reverse*. This is necessary in